/** * 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'); }
/** * 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(); }
/** * Initializes a new customer manager object using the given context object. * * @param MShop_Context_Interface $context Context object with required objects */ public function __construct(MShop_Context_Item_Interface $context) { parent::__construct($context); $plugin = new MW_Common_Criteria_Plugin_T3Salutation(); $this->_plugins['customer.salutation'] = $this->_reverse['gender'] = $plugin; $plugin = new MW_Common_Criteria_Plugin_T3Status(); $this->_plugins['customer.status'] = $this->_reverse['disable'] = $plugin; $plugin = new MW_Common_Criteria_Plugin_T3Date(); $this->_plugins['customer.birthday'] = $this->_reverse['date_of_birth'] = $plugin; $plugin = new MW_Common_Criteria_Plugin_T3Datetime(); $this->_plugins['customer.ctime'] = $this->_reverse['crdate'] = $plugin; $this->_plugins['customer.mtime'] = $this->_reverse['tstamp'] = $plugin; $this->_pid = $context->getConfig()->get('mshop/customer/manager/typo3/pid-default', 0); }