diff --git a/app/tests/Domain/Repository/UserRepositoryTest.php b/app/tests/Domain/Repository/UserRepositoryTest.php index 381d5e2..36044d6 100644 --- a/app/tests/Domain/Repository/UserRepositoryTest.php +++ b/app/tests/Domain/Repository/UserRepositoryTest.php @@ -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()); + } }