コード例 #1
0
ファイル: DbTest.php プロジェクト: relue/magento2
 /**
  * @param PHPUnit_Framework_MockObject_MockObject|Zend_Db_Adapter_Abstract $adapter
  * @depends testSetAddOrder
  */
 public function testUnshiftOrder($adapter)
 {
     $this->_collection->setConnection($adapter);
     $this->_collection->addOrder('some_field', Varien_Data_Collection::SORT_ORDER_ASC);
     $this->_collection->unshiftOrder('other_field', Varien_Data_Collection::SORT_ORDER_ASC);
     $this->_collection->load();
     $selectOrders = $this->_collection->getSelect()->getPart(Zend_Db_Select::ORDER);
     $this->assertEquals('other_field ASC', (string) array_shift($selectOrders));
     $this->assertEquals('some_field ASC', (string) array_shift($selectOrders));
     $this->assertEmpty(array_shift($selectOrders));
 }
コード例 #2
0
ファイル: DbTest.php プロジェクト: nemphys/magento2
 /**
  * Test that after cloning collection $this->_select in initial and cloned collections
  * do not reference the same object
  *
  * @covers Varien_Data_Collection_Db::__clone
  */
 public function testClone()
 {
     $adapter = $this->_getAdapterMock('Zend_Db_Adapter_Pdo_Mysql', null, null);
     $this->_collection->setConnection($adapter);
     $this->assertInstanceOf('Zend_Db_Select', $this->_collection->getSelect());
     $clonedCollection = clone $this->_collection;
     $this->assertInstanceOf('Zend_Db_Select', $clonedCollection->getSelect());
     $this->assertNotSame($clonedCollection->getSelect(), $this->_collection->getSelect(), 'Collection was cloned but $this->_select in both initial and cloned collections reference the same object');
 }
コード例 #3
0
ファイル: DbTest.php プロジェクト: natxetee/magento2
 /**
  * Test that after cloning collection $this->_select in initial and cloned collections
  * do not reference the same object
  *
  * @covers Varien_Data_Collection_Db::__clone
  */
 public function testClone()
 {
     $adapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', array(), '', false);
     $this->_collection->setConnection($adapter);
     $this->assertInstanceOf('Zend_Db_Select', $this->_collection->getSelect());
     $clonedCollection = clone $this->_collection;
     $this->assertInstanceOf('Zend_Db_Select', $clonedCollection->getSelect());
     $this->assertNotSame($clonedCollection->getSelect(), $this->_collection->getSelect(), 'Collection was cloned but $this->_select in both initial and cloned collections reference the same object');
 }