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\SystemClock;
11
12test('Should return current date', function (): void {
13    $clock = new SystemClock();
14
15    $result = $clock->now();
16
17    expect($result)->toBeInstanceOf(DateTimeImmutable::class);
18});
19
20test('Should return different dates on each call', function (): void {
21    $clock = new SystemClock();
22
23    $firstCall = $clock->now();
24    usleep(1000); // Wait 1ms to ensure different timestamps
25    $secondCall = $clock->now();
26
27    expect($firstCall)->not->toEqual($secondCall);
28});