Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Improved unit tests with feedbacks from #224
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Nov 29, 2017
1 parent 90eca3a commit 2e3bf2d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
12 changes: 5 additions & 7 deletions test/Adapter/Driver/Pdo/StatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,11 @@ public function testExecuteWithSpecialCharInBindParam()
$this->statement->setDriver(new Pdo(new Connection($testSqlite)));
$this->statement->initialize($testSqlite);

$this->statement->prepare(
'INSERT INTO test (text_, text$) VALUES (:' .
md5('text_') .
', :' .
md5('text$') .
')'
);
$this->statement->prepare(sprintf(
'INSERT INTO test (text_, text$) VALUES (:%s, :%s)',
md5('text_'),
md5('text$')
));
$result = $this->statement->execute([ 'text_' => 'foo', 'text$' => 'bar']);
$this->assertInstanceOf(Result::class, $result);
$this->assertTrue($result->valid());
Expand Down
18 changes: 9 additions & 9 deletions test/Adapter/Driver/Pdo/TestAsset/SqliteMemoryPdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ public function __construct($sql = null)
{
parent::__construct('sqlite::memory:');

// execute the sql statement if not empty
if (!empty($sql)) {
if (false === $this->exec($sql)) {
throw new \Exception(sprintf(
"Error: %s, %s",
$this->errorCode(),
implode(",", $this->errorInfo())
));
}
if (empty($sql)) {
return;
}
if (false === $this->exec($sql)) {
throw new \Exception(sprintf(
"Error: %s, %s",
$this->errorCode(),
implode(",", $this->errorInfo())
));
}
}
}

0 comments on commit 2e3bf2d

Please sign in to comment.