extract auth test fakes

This commit is contained in:
Yisroel Baum 2026-05-18 22:01:45 +03:00
parent ae07a6ff7c
commit 64acbfad60
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 58 additions and 29 deletions

View file

@ -0,0 +1,15 @@
<?php
namespace Tests\Fakes;
use App\Auth\Clock;
use DateTimeImmutable;
use DateTimeZone;
class FakeClock implements Clock
{
public function now(): DateTimeImmutable
{
return new DateTimeImmutable('2026-05-18 12:00:00', new DateTimeZone('UTC'));
}
}

View file

@ -0,0 +1,18 @@
<?php
namespace Tests\Fakes;
use App\Auth\PasswordHasher;
class FakeHasher implements PasswordHasher
{
public function hash(string $password): string
{
return 'hashed-' . $password;
}
public function verify(string $password, string $hash): bool
{
return $hash === 'hashed-' . $password;
}
}

View file

@ -0,0 +1,13 @@
<?php
namespace Tests\Fakes;
use App\Auth\TokenGenerator;
class FakeTokenGenerator implements TokenGenerator
{
public function generate(): string
{
return 'fake-token-123';
}
}