give fake clock a constructor
This commit is contained in:
parent
a859c87455
commit
f143562a40
1 changed files with 8 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue