test: add failing authenticate user test
Red phase: write AuthenticateUserTest with cases for valid credentials, empty email/password (null and empty string), unknown email, wrong password, and fresh instance guarantee. Fakes included.
This commit is contained in:
parent
9d9771de6e
commit
57c75f64c4
9 changed files with 2175 additions and 2 deletions
21
backend/tests/Fakes/FakeClock.php
Normal file
21
backend/tests/Fakes/FakeClock.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue