From f143562a4086fe4a04d2635161a1ae6cbe1909b9 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Tue, 19 May 2026 19:54:12 +0300 Subject: [PATCH] give fake clock a constructor --- backend/tests/Fakes/FakeClock.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/tests/Fakes/FakeClock.php b/backend/tests/Fakes/FakeClock.php index f32d5a4..f112836 100644 --- a/backend/tests/Fakes/FakeClock.php +++ b/backend/tests/Fakes/FakeClock.php @@ -4,12 +4,18 @@ namespace Tests\Fakes; use App\Auth\Clock; use DateTimeImmutable; -use DateTimeZone; class FakeClock implements Clock { + public function __construct(private DateTimeImmutable $currentTime) {} + public function now(): DateTimeImmutable { - return new DateTimeImmutable('2026-05-18 12:00:00', new DateTimeZone('UTC')); + return $this->currentTime; + } + + public function setTime(DateTimeImmutable $newTime): void + { + $this->currentTime = $newTime; } }