/** * Creates a criteria object for searching. * * @param boolean $default Include default criteria like the status * @return MW_Common_Criteria_Interface Search criteria object */ public function createSearch($default = false) { if ($default === true) { $dbm = $this->_getContext()->getDatabaseManager(); $conn = $dbm->acquire(); $object = new MW_Common_Criteria_SQL($conn); $object->setConditions($object->compare('==', 'customer.status', 1)); $dbm->release($conn); return $object; } return parent::createSearch(); }
/** * Sets up the fixture. This method is called before a test is executed. */ protected function setUp() { $this->_editor = TestHelper::getContext()->getEditor(); $customer = new MShop_Customer_Manager_Default(TestHelper::getContext()); $search = $customer->createSearch(); $conditions = array($search->compare('==', 'customer.label', 'unitCustomer001'), $search->compare('==', 'customer.editor', $this->_editor)); $search->setConditions($search->combine('&&', $conditions)); $result = $customer->searchItems($search); if (($customerItem = reset($result)) === false) { throw new Exception(sprintf('No customer item found for label "%1$s".', 'unitCustomer001')); } $this->_fixture = array('refid' => $customerItem->getId(), 'company' => 'Metaways', 'vatid' => 'DE999999999', 'salutation' => MShop_Common_Item_Address_Abstract::SALUTATION_MR, 'titlekey' => MShop_Common_Item_Address_Abstract::SALUTATION_MR, 'title' => 'Herr', 'firstname' => 'firstunit', 'lastname' => 'lastunit', 'address1' => 'unit str.', 'address2' => ' 166', 'address3' => '4.OG', 'postal' => '22769', 'city' => 'Hamburg', 'state' => 'Hamburg', 'countryid' => 'de', 'langid' => 'de', 'telephone' => '05554433221', 'email' => '*****@*****.**', 'telefax' => '05554433222', 'website' => 'www.metaways.de', 'position' => 1, 'siteid' => TestHelper::getContext()->getLocale()->getSiteId()); $this->_object = $customer->getSubManager('address', 'Default'); }