Skip to content

Commit

Permalink
Making one line change and adding unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ActuallyConnor committed Nov 1, 2024
1 parent 7502220 commit 4d99a12
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Pdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function inTransaction(): bool
return $this->inTransaction;
}

public function exec($statement): false|int
public function exec(string $statement): false|int
{
$result = $this->query($statement);

Expand Down
24 changes: 23 additions & 1 deletion tests/Unit/PdoQueriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use PHPUnit\Framework\TestCase;
use Pseudo\Pdo;
use Pseudo\Result;
use Pseudo\UnitTest\SampleModels\PdoQueries;
use RuntimeException;

Expand Down Expand Up @@ -48,6 +47,29 @@ public function testSelectQueryWithNoParameters(): void
);
}

public function testSelectSingleRow(): void
{
$this->pdo->mock(
'SELECT * FROM users ORDER BY id DESC LIMIT 1',
[],
[
[
'id' => 1,
'name' => 'John Doe',
]
]
);

$data = $this->pdoQueries->selectSingleRow();
$this->assertEquals(
[
'id' => 1,
'name' => 'John Doe',
],
$data
);
}

public function testSelectQueryWithPlaceholders(): void
{
$this->pdo->mock(
Expand Down

0 comments on commit 4d99a12

Please sign in to comment.