no need to test concrete implementations

This commit is contained in:
Yisroel Baum 2026-04-26 10:23:57 +03:00
parent a65c9259fa
commit 2fe41a5fe7
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 3 additions and 120 deletions

View file

@ -1,52 +0,0 @@
<?php
namespace Tests\Unit\User;
use App\User\UseCases\CreateUserDto;
use App\User\User;
use App\ValueObjects\EmailAddress;
use PHPUnit\Framework\TestCase;
use Tests\Fakes\FakeUserRepository;
class FakeUserRepositoryTest extends TestCase
{
public function test_find_by_email_returns_user(): void
{
$userRepo = new FakeUserRepository();
$userRepo->create(new CreateUserDto(
email: new EmailAddress('test@test.com'),
passwordHash: '',
));
$user = $userRepo->findByEmail(new EmailAddress('test@test.com'));
$this->assertInstanceOf(User::class, $user);
$this->assertEquals('test@test.com', $user->getEmail()->value());
}
public function test_find_by_email_returns_null_when_not_found(): void
{
$userRepo = new FakeUserRepository();
$user = $userRepo->findByEmail(
new EmailAddress('missing@test.com')
);
$this->assertNull($user);
}
public function test_find_by_email_returns_fresh_instance(): void
{
$userRepo = new FakeUserRepository();
$created = $userRepo->create(new CreateUserDto(
email: new EmailAddress('test@test.com'),
passwordHash: '',
));
$fetched = $userRepo->findByEmail(
new EmailAddress('test@test.com')
);
$this->assertNotSame($created, $fetched);
}
}