format backend code
This commit is contained in:
parent
9577367622
commit
67dd376a2f
40 changed files with 146 additions and 71 deletions
|
|
@ -25,7 +25,10 @@ class AuthenticateUserTest extends TestCase
|
|||
$this->userRepo = new FakeUserRepository();
|
||||
$this->hasher = new FakeHasher();
|
||||
|
||||
$this->authenticateUser = new AuthenticateUser($this->userRepo, $this->hasher);
|
||||
$this->authenticateUser = new AuthenticateUser(
|
||||
$this->userRepo,
|
||||
$this->hasher
|
||||
);
|
||||
}
|
||||
|
||||
public function testAuthenticatesValidUser(): void
|
||||
|
|
|
|||
|
|
@ -44,8 +44,14 @@ class CreateSessionTest extends TestCase
|
|||
$this->assertSame('fake-token-123', $session->getToken());
|
||||
$this->assertSame($user, $session->getUser());
|
||||
$this->assertFalse($session->isExpired($this->clock->now()));
|
||||
$this->assertSame('2026-05-18 12:00:00', $session->getCreatedAt()->format('Y-m-d H:i:s'));
|
||||
$this->assertSame('2026-05-25 12:00:00', $session->getExpiresAt()->format('Y-m-d H:i:s'));
|
||||
$this->assertSame(
|
||||
'2026-05-18 12:00:00',
|
||||
$session->getCreatedAt()->format('Y-m-d H:i:s')
|
||||
);
|
||||
$this->assertSame(
|
||||
'2026-05-25 12:00:00',
|
||||
$session->getExpiresAt()->format('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
$stored = $this->sessionRepo->findByToken($session->getToken());
|
||||
$this->assertNotNull($stored);
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ class LogoutTest extends TestCase
|
|||
'2026-04-29T12:00:00',
|
||||
new DateTimeZone('UTC')
|
||||
);
|
||||
$this->sessionRepo = new FakeSessionRepository;
|
||||
$this->sessionRepo = new FakeSessionRepository();
|
||||
$this->useCase = new Logout($this->sessionRepo);
|
||||
}
|
||||
|
||||
public function test_existing_token_session_is_removed(): void
|
||||
public function testExistingTokenSessionIsRemoved(): void
|
||||
{
|
||||
$this->sessionRepo->create(new CreateSessionDto(
|
||||
token: 'token-abc',
|
||||
|
|
@ -47,7 +47,7 @@ class LogoutTest extends TestCase
|
|||
$this->assertNull($this->sessionRepo->findByToken('token-abc'));
|
||||
}
|
||||
|
||||
public function test_unknown_token_does_not_throw(): void
|
||||
public function testUnknownTokenDoesNotThrow(): void
|
||||
{
|
||||
$this->useCase->execute('unknown-token');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue