ZF-10980: Zend_Db testAdapterLimitOffset doesn't adequately check ORDER BY
Thankfully there is already an ORDER BY clause in the Zend_Db_Adapter_TestCommon::testAdapterLimitOffset unit test. Unfortunately, it always selects the middle element of three -- limiting to the first row with an offset one. The ORDER BY also is ASC so it is likely equal to the existing order of rows in the table.
I'd suggest changing the ORDER by DESC, and setting the offset to two. This is the reason the error isn't being caught as an issue in at least the DB2 adapter (see parent task).
Index: Zend/Db/Adapter/TestCommon.php =================================================================== --- Zend/Db/Adapter/TestCommon.php (revision 23613) +++ Zend/Db/Adapter/TestCommon.php (working copy) @@ -743,7 +743,7 @@ $products = $this->_db->quoteIdentifier('zfproducts'); $product_id = $this->_db->quoteIdentifier('product_id'); - $sql = $this->_db->limit("SELECT * FROM $products ORDER BY $product_id", 1, 1); + $sql = $this->_db->limit("SELECT * FROM $products ORDER BY $product_id DESC", 1, 2); $stmt = $this->_db->query($sql); $result = $stmt->fetchAll(); @@ -751,8 +751,8 @@ 'Expecting row count to be 1'); $this->assertEquals(2, count($result), 'Expecting column count to be 2'); - $this->assertEquals(2, $result['product_id'], - 'Expecting to get product_id 2'); + $this->assertEquals(1, $result['product_id'], + 'Expecting to get product_id 1'); // Check that extra field ZEND_DB_ROWNUM isn't present // (particulary with Db2 & Oracle)