add fake clock

This commit is contained in:
Yisroel Baum 2026-04-24 13:23:46 +03:00
parent de4d577781
commit 78ffb77f9f
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

23
tests/Fakes/FakeClock.php Normal file
View file

@ -0,0 +1,23 @@
<?php
namespace Tests\Fakes;
use App\Auth\Clock;
use DateTimeImmutable;
class FakeClock implements Clock
{
public function __construct(
private DateTimeImmutable $currentTime,
) {}
public function now(): DateTimeImmutable
{
return $this->currentTime;
}
public function setTime(DateTimeImmutable $newTime): void
{
$this->currentTime = $newTime;
}
}