diff --git a/app/src/Infrastructure/Api/Database/DatabaseHandlerInterface.php b/app/src/Infrastructure/Api/Database/DatabaseHandlerInterface.php index 594d488..4a87162 100644 --- a/app/src/Infrastructure/Api/Database/DatabaseHandlerInterface.php +++ b/app/src/Infrastructure/Api/Database/DatabaseHandlerInterface.php @@ -6,7 +6,10 @@ use PDO; interface DatabaseHandlerInterface { - public function getConnection(): PDO; + /** + * @return mixed The return must be an active connection to a database. + */ + public function getConnection(); /** * Get the connection string required for establishing connections to the diff --git a/app/src/Infrastructure/Database/DatabaseHandler.php b/app/src/Infrastructure/Database/DatabaseHandler.php index 2835a0c..8f3f9cc 100644 --- a/app/src/Infrastructure/Database/DatabaseHandler.php +++ b/app/src/Infrastructure/Database/DatabaseHandler.php @@ -19,7 +19,10 @@ class DatabaseHandler implements DatabaseHandlerInterface $this->pdo = new PDO($this->getDsn(), $username, $password); } - public function getConnection(): PDO + /** + * @return PDO For this particular Handler we will return the PDO objectg + */ + public function getConnection() { return $this->pdo; } diff --git a/app/tests/Domain/Repository/UserRepositoryTest.php b/app/tests/Domain/Repository/UserRepositoryTest.php index 80e3fd1..fbf55f3 100644 --- a/app/tests/Domain/Repository/UserRepositoryTest.php +++ b/app/tests/Domain/Repository/UserRepositoryTest.php @@ -6,6 +6,8 @@ use Slovocast\Domain\Repository\User\UserRepository; use Slovocast\Infrastructure\Api\Database\DatabaseHandlerInterface; use Slovocast\Infrastructure\User\BasicUserAuthorization; use Slovocast\Tests\TestCase; +use Prophecy\Argument; + class UserRepositoryTest extends TestCase { @@ -14,7 +16,10 @@ class UserRepositoryTest extends TestCase $user = $this->getUserFromArray(); $databaseHandler = $this->prophesize(DatabaseHandlerInterface::class); - $databaseHandler->insert()->willReturn(true); + $databaseHandler->insert( + Argument::type('string'), + Argument::type('array') + )->willReturn(true); $databaseHandler->getConnection()->willReturn(new class { public function lastInsertId(): int {