Skip to content

Commit

Permalink
More cursor closing
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 28, 2014
1 parent 17f2e99 commit 49dd990
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/TestCase/Database/ConnectionTest.php
Expand Up @@ -147,12 +147,14 @@ public function testExecuteWithArguments() {
$this->assertCount(1, $statement);
$result = $statement->fetch();
$this->assertEquals([2], $result);
$result->closeCursor();

$sql = 'SELECT 1 + ? + ? AS total';
$statement = $this->connection->execute($sql, [2, 3], array('integer', 'integer'));
$this->assertCount(1, $statement);
$result = $statement->fetch('assoc');
$this->assertEquals(['total' => 6], $result);
$result->closeCursor();

$sql = 'SELECT 1 + :one + :two AS total';
$statement = $this->connection->execute($sql, ['one' => 2, 'two' => 3], array('one' => 'integer', 'two' => 'integer'));
Expand All @@ -171,6 +173,7 @@ public function testExecuteWithArgumentsAndTypes() {
$sql = "SELECT ? = '2012-01-01'";
$statement = $this->connection->execute($sql, [new \DateTime('2012-01-01')], ['date']);
$result = $statement->fetch();
$result->closeCursor();
$this->assertTrue((bool)$result[0]);

$sql = "SELECT ? = '2012-01-01', ? = '2000-01-01 10:10:10', ? = 2";
Expand Down

0 comments on commit 49dd990

Please sign in to comment.