Get a user from the database
This commit is contained in:
parent
2269254e26
commit
e5bd4e5841
@ -50,4 +50,33 @@ class UserRepositoryTest extends TestCase
|
||||
(new \DateTime())->format("dmY")
|
||||
);
|
||||
}
|
||||
|
||||
public function getGettingUsers(): void
|
||||
{
|
||||
$hasher = new BasicUserAuthorization();
|
||||
$password = "password";
|
||||
$hashedPassword = $hasher->hash($password);
|
||||
|
||||
$databaseHandler = $this->prophesize(DatabaseHandlerInterface::class);
|
||||
$databaseHandler
|
||||
->query(Argument::type('string'), Argument::type('array'))
|
||||
->willReturn([
|
||||
[
|
||||
'id' => 1,
|
||||
'name' => 'Dave Test',
|
||||
'email' => 'dave.test@email',
|
||||
'password' => $hashedPassword,
|
||||
'created_at' => '2024-11-17T00:00:00',
|
||||
'updated_at' => '2024-11-17T00:00:00'
|
||||
]
|
||||
]);
|
||||
|
||||
$userRepository = new UserRepository(
|
||||
$databaseHandler->reveal(),
|
||||
$hasher
|
||||
);
|
||||
|
||||
$user = $user->get(1);
|
||||
$this->assertEquals("Dave Test", $user->getName());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user