test auth contracts
This commit is contained in:
parent
3da9c586c3
commit
b3266b38c8
15 changed files with 457 additions and 165 deletions
|
|
@ -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(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue