diff --git a/library/Zend/Db/Adapter/Driver/Pdo/Result.php b/library/Zend/Db/Adapter/Driver/Pdo/Result.php index b73c5b5d31c..4bc363955d0 100644 --- a/library/Zend/Db/Adapter/Driver/Pdo/Result.php +++ b/library/Zend/Db/Adapter/Driver/Pdo/Result.php @@ -77,6 +77,7 @@ public function initialize(PDOStatement $resource, $generatedValue, $rowCount = $this->resource = $resource; $this->generatedValue = $generatedValue; $this->rowCount = $rowCount; + return $this; } @@ -117,6 +118,8 @@ public function current() } $this->currentData = $this->resource->fetch(\PDO::FETCH_ASSOC); + $this->currentComplete = true; + return $this->currentData; } @@ -130,6 +133,7 @@ public function next() $this->currentData = $this->resource->fetch(\PDO::FETCH_ASSOC); $this->currentComplete = true; $this->position++; + return $this->currentData; } @@ -184,6 +188,7 @@ public function count() } else { $this->rowCount = (int) $this->resource->rowCount(); } + return $this->rowCount; } diff --git a/tests/ZendTest/Db/Adapter/Driver/Pdo/ResultTest.php b/tests/ZendTest/Db/Adapter/Driver/Pdo/ResultTest.php new file mode 100644 index 00000000000..57da4f6088a --- /dev/null +++ b/tests/ZendTest/Db/Adapter/Driver/Pdo/ResultTest.php @@ -0,0 +1,34 @@ +getMock('PDOStatement'); + $stub + ->expects($this->any()) + ->method('fetch') + ->will($this->returnCallback(function () {return uniqid();})); + + $result = new Result(); + $result->initialize($stub, null); + + $this->assertEquals($result->current(), $result->current()); + } +}