|
|
@@ -297,28 +297,55 @@ class Zend_Db_Adapter_Pdo_MssqlTest extends Zend_Db_Adapter_Pdo_TestCommon
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Test the Adapter's insert() method.
|
|
|
- * This requires providing an associative array of column=>value pairs.
|
|
|
- */
|
|
|
- public function testAdapterInsert()
|
|
|
- {
|
|
|
- $row = array (
|
|
|
- 'bug_description' => 'New bug',
|
|
|
- 'bug_status' => 'NEW',
|
|
|
- 'created_on' => '2007-04-02',
|
|
|
- 'updated_on' => '2007-04-02',
|
|
|
- 'reported_by' => 'micky',
|
|
|
- 'assigned_to' => 'goofy',
|
|
|
- 'verified_by' => 'dduck'
|
|
|
- );
|
|
|
- $rowsAffected = $this->_db->insert('zfbugs', $row);
|
|
|
- $this->assertEquals(1, $rowsAffected);
|
|
|
- $lastInsertId = $this->_db->lastInsertId();
|
|
|
- $this->assertType('integer', $lastInsertId);
|
|
|
- $this->assertEquals('5', (string) $lastInsertId,
|
|
|
- 'Expected new id to be 5');
|
|
|
- }
|
|
|
+ * Test the Adapter's insert() method.
|
|
|
+ * This requires providing an associative array of column=>value pairs.
|
|
|
+ */
|
|
|
+ public function testAdapterInsert()
|
|
|
+ {
|
|
|
+ $row = array (
|
|
|
+ 'bug_description' => 'New bug',
|
|
|
+ 'bug_status' => 'NEW',
|
|
|
+ 'created_on' => '2007-04-02',
|
|
|
+ 'updated_on' => '2007-04-02',
|
|
|
+ 'reported_by' => 'micky',
|
|
|
+ 'assigned_to' => 'goofy',
|
|
|
+ 'verified_by' => 'dduck'
|
|
|
+ );
|
|
|
+ $rowsAffected = $this->_db->insert('zfbugs', $row);
|
|
|
+ $this->assertEquals(1, $rowsAffected);
|
|
|
+ $lastInsertId = $this->_db->lastInsertId();
|
|
|
+ $this->assertType('integer', $lastInsertId);
|
|
|
+ $this->assertEquals('5', (string) $lastInsertId,
|
|
|
+ 'Expected new id to be 5');
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * @group ZF-4099
|
|
|
+ */
|
|
|
+ public function testAdapterLimitWorksWithOrderByClause()
|
|
|
+ {
|
|
|
+ // more values
|
|
|
+ $this->_db->insert('zfproducts', array('product_name' => 'Unix'));
|
|
|
+ $this->_db->insert('zfproducts', array('product_name' => 'Windows'));
|
|
|
+ $this->_db->insert('zfproducts', array('product_name' => 'AIX'));
|
|
|
+ $this->_db->insert('zfproducts', array('product_name' => 'I5'));
|
|
|
+ $this->_db->insert('zfproducts', array('product_name' => 'Linux'));
|
|
|
+
|
|
|
+ $select = $this->_db->select();
|
|
|
+ $select->from('zfproducts')
|
|
|
+ ->order(array('product_name ASC', 'product_id DESC'))
|
|
|
+ ->limit(4, 4);
|
|
|
+ $products = $this->_db->fetchAll($select);
|
|
|
+ $expectedProducts = array(
|
|
|
+ 0 => array('product_id' => '3', 'product_name' => 'OS X'),
|
|
|
+ 1 => array('product_id' => '4', 'product_name' => 'Unix'),
|
|
|
+ 2 => array('product_id' => '5', 'product_name' => 'Windows'),
|
|
|
+ 3 => array ('product_id' => '1', 'product_name' => 'Windows')
|
|
|
+ );
|
|
|
+ $this->assertEquals($expectedProducts, $products);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public function getDriver()
|
|
|
{
|
|
|
return 'Pdo_Mssql';
|