Index: tests/Zend/Db/Table/Select/TestCommon.php =================================================================== --- tests/Zend/Db/Table/Select/TestCommon.php (revision 21084) +++ tests/Zend/Db/Table/Select/TestCommon.php (working copy) @@ -301,4 +301,39 @@ // $this->assertEquals(1, count($columns)); // $this->assertEquals('product_id', $columns[0][1]); // } + + + /** + * Test the Adapter's fetchRow() method with a select with offset + * @group ZF-8944 + */ + public function testAdapterFetchRowWithOffset() + { + $table = $this->_getSelectTable('products'); + $products = $this->_db->quoteIdentifier('zfproducts'); + $product_id = $this->_db->quoteIdentifier('product_id'); + + // Grab the first two rows + $data = $this->_db->fetchAll("SELECT * from $products ORDER BY $product_id LIMIT 2"); + if (count($data) < 2) { + $this->markTestSkipped('Not enough data available to test offset.'); + } + + $select = $table->select(); + $select->order('product_id'); + $select->limit(1, 0); + + $row = $this->_db->fetchRow($select); + + $this->assertEquals($data[0], $row); + + $select = $table->select(); + $select->order('product_id'); + $select->limit(1, 1); + + $row = $this->_db->fetchRow($select); + + $this->assertEquals($data[1], $row); + } + }