コード例 #1
0
ファイル: CollectionTest.php プロジェクト: nemphys/magento2
 /**
  * Test setCustomerFilter() using array of Ids as possible filter
  */
 public function testSetArrayAsCustomerFilter()
 {
     $customerIds = array(1, 2);
     $expectedString = "parent_id IN (" . implode(',', $customerIds) . ")";
     $this->_collection->getConnection()->expects($this->any())->method('prepareSqlCondition')->with($this->stringContains('parent_id'), array('in' => $customerIds))->will($this->returnValue($expectedString));
     $this->_collection->setCustomerFilter($customerIds);
     $this->assertContains('(' . $expectedString . ')', $this->_collection->getSelect()->getPart(Zend_Db_Select::WHERE));
 }
コード例 #2
0
 public function testSetCustomerFilter()
 {
     $collection = new Mage_Customer_Model_Resource_Address_Collection();
     $select = $collection->getSelect();
     $this->assertSame($collection, $collection->setCustomerFilter(array(1, 2)));
     $customer = Mage::getObjectManager()->create('Mage_Customer_Model_Customer');
     $collection->setCustomerFilter($customer);
     $customer->setId(3);
     $collection->setCustomerFilter($customer);
     $this->assertStringMatchesFormat('%AWHERE%S(%Sparent_id%S IN(%S1%S, %S2%S))%SAND%S(%Sparent_id%S = %S-1%S)%SAND%S(%Sparent_id%S = %S3%S)%A', (string) $select);
 }