Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3// ╔════════════════════════════════════════════════════════════╗
4// ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║
5// ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com>     ║
6// ╚════════════════════════════════════════════════════════════╝
7
8declare(strict_types=1);
9
10use Phexium\Plugin\Clock\Adapter\FrozenClock;
11
12test('Should return frozen date', function (): void {
13    $date = '2025-12-31T01:23:45+00:00';
14    $clock = new FrozenClock($date);
15
16    $result = $clock->now();
17
18    expect($result->format(DateTimeInterface::ATOM))->toBe($date);
19});
20
21test('Should return same date on multiple calls', function (): void {
22    $clock = new FrozenClock('2025-01-01T12:00:00+00:00');
23
24    $first = $clock->now();
25    $second = $clock->now();
26
27    expect($first)->toEqual($second);
28});