test auth contracts

This commit is contained in:
Yisroel Baum 2026-08-02 20:53:15 +03:00
parent 3da9c586c3
commit b3266b38c8
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
15 changed files with 457 additions and 165 deletions

View file

@ -2,6 +2,7 @@
namespace Tests\Feature\Database;
use App\Auth\PasswordHasher;
use App\Shared\ValueObject\EmailAddress;
use App\User\UserRepository;
use Illuminate\Foundation\Testing\RefreshDatabase;
@ -21,15 +22,18 @@ class DatabaseSeederTest extends TestCase
]);
$this->assertDatabaseMissing('users', [
'email' => 'user@example.com',
'password' => 'password',
'passwordHash' => 'password',
]);
$this->assertDatabaseCount('users', 1);
$user = app(UserRepository::class)->findByCredentials(
$user = app(UserRepository::class)->findByEmail(
new EmailAddress('user@example.com'),
'password',
);
$this->assertNotNull($user);
$this->assertTrue(app(PasswordHasher::class)->verify(
'password',
$user->getPasswordHash(),
));
}
}