当前位置: 首页>>代码示例>>PHP>>正文


PHP Manager\Factory类代码示例

本文整理汇总了PHP中Aimeos\MShop\Customer\Manager\Factory的典型用法代码示例。如果您正苦于以下问题:PHP Factory类的具体用法?PHP Factory怎么用?PHP Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * Sets up the fixture.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->editor = \TestHelper::getContext()->getEditor();
     $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'Typo3');
     $listManager = $manager->getSubManager('lists', 'Typo3');
     $this->object = $listManager->getSubManager('type', 'Typo3');
 }
开发者ID:aimeos,项目名称:ai-typo3,代码行数:13,代码来源:Typo3Test.php

示例2: testProcess

 public function testProcess()
 {
     $type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY;
     $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
     $addrManager = $manager->getSubManager('address');
     $search = $manager->createSearch();
     $search->setSlice(0, 1);
     $result = $manager->searchItems($search);
     if (($customerItem = reset($result)) === false) {
         throw new \RuntimeException('No customer item found');
     }
     $addrItem = $customerItem->getPaymentAddress();
     $addrItem->setId(null);
     $basketCntl = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $basketCntl->setAddress($type, $addrItem);
     $view = \TestHelperHtml::getView();
     $view->orderBasket = $basketCntl->get();
     $view->orderBasket->setCustomerId($customerItem->getId());
     $this->object->setView($view);
     $this->object->process();
     $orderAddress = $view->orderBasket->getAddress($type);
     $actual = $addrManager->getItem($orderAddress->getAddressId());
     $addrManager->deleteItem($actual->getId());
     $this->assertEquals($addrItem->getFirstname(), $actual->getFirstname());
     $this->assertEquals($addrItem->getLastname(), $actual->getLastname());
     $this->assertEquals($addrItem->getPostal(), $actual->getPostal());
     $this->assertEquals($addrItem->getTelephone(), $actual->getTelephone());
     $this->assertEquals($addrItem->getTelefax(), $actual->getTelefax());
 }
开发者ID:aimeos,项目名称:ai-client-html,代码行数:29,代码来源:StandardTest.php

示例3: testProcess

 public function testProcess()
 {
     $type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT;
     $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
     $search = $manager->createSearch();
     $search->setSlice(0, 1);
     $result = $manager->searchItems($search);
     if (($customerItem = reset($result)) === false) {
         throw new \Exception('No customer item found');
     }
     $addrItem = $customerItem->getPaymentAddress();
     $addrItem->setEmail('unittest@aimeos.org');
     $mailStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\None')->disableOriginalConstructor()->getMock();
     $mailMsgStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\Message\\None')->disableOriginalConstructor()->disableOriginalClone()->getMock();
     $mailStub->expects($this->once())->method('createMessage')->will($this->returnValue($mailMsgStub));
     $mailStub->expects($this->once())->method('send');
     $this->context->setMail($mailStub);
     $basketCntl = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $basketCntl->setAddress($type, $addrItem);
     $view = \TestHelperHtml::getView();
     $view->orderBasket = $basketCntl->get();
     $this->context->setView($view);
     $this->object->setView($view);
     $orderBaseStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
     $customerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Customer\\Manager\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
     $orderBaseStub->expects($this->once())->method('saveItem');
     $customerStub->expects($this->once())->method('saveItem');
     \Aimeos\MShop\Factory::injectManager($this->context, 'customer', $customerStub);
     \Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $orderBaseStub);
     $this->object->process();
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:31,代码来源:StandardTest.php

示例4: migrate

 /**
  * Adds attribute test data.
  */
 public function migrate()
 {
     $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
     if (!$this->additional instanceof $iface) {
         throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
     }
     $this->msg('Adding Fos user bundle customer test data', 0);
     $parentIds = array();
     $ds = DIRECTORY_SEPARATOR;
     $this->additional->setEditor('ai-fosuser:unittest');
     $path = __DIR__ . $ds . 'data' . $ds . 'customer.php';
     if (($testdata = (include $path)) === false) {
         throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path));
     }
     $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'FosUser');
     $customerAddressManager = $customerManager->getSubManager('address', 'FosUser');
     $search = $customerManager->createSearch();
     $search->setConditions($search->compare('==', 'customer.code', array('UTC001', 'UTC002', 'UTC003')));
     $items = $customerManager->searchItems($search);
     $this->conn->begin();
     $customerManager->deleteItems(array_keys($items));
     $parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem());
     $this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds);
     $this->conn->commit();
     $this->status('done');
 }
开发者ID:aimeos,项目名称:ai-fosuser,代码行数:29,代码来源:CustomerAddFosUserTestData.php

示例5: migrate

 /**
  * Inserts customer items.
  */
 public function migrate()
 {
     $this->msg('Adding customer performance data', 0);
     $context = $this->getContext();
     $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context);
     $customerItem = $customerManager->createItem();
     $customerItem->setCode('demo-test');
     $customerItem->setLabel('Test demo unitperf user');
     $customerItem->setPassword(sha1(microtime(true) . getmypid() . rand()));
     $customerItem->setStatus(1);
     $addrItem = $customerItem->getPaymentAddress();
     $addrItem->setCompany('Test company');
     $addrItem->setVatID('DE999999999');
     $addrItem->setSalutation('mr');
     $addrItem->setFirstname('Testdemo');
     $addrItem->setLastname('Perfuser');
     $addrItem->setAddress1('Test street');
     $addrItem->setAddress2('1');
     $addrItem->setPostal('1000');
     $addrItem->setCity('Test city');
     $addrItem->setLanguageId('en');
     $addrItem->setCountryId('DE');
     $addrItem->setEmail('me@localhost');
     $customerManager->saveItem($customerItem);
     $this->status('done');
 }
开发者ID:aimeos,项目名称:aimeos-core,代码行数:29,代码来源:CustomerAddBasePerfData.php

示例6: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelperHtml::getContext());
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'customer.code', 'UTC001'));
     $result = $manager->searchItems($search);
     if ((self::$customerItem = reset($result)) === false) {
         throw new \Exception('No customer found');
     }
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:10,代码来源:StandardTest.php

示例7: getCustomerItem

 /**
  * @param string $code
  */
 protected function getCustomerItem($code)
 {
     $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'customer.code', $code));
     $items = $manager->searchItems($search);
     if (($item = reset($items)) === false) {
         throw new \RuntimeException(sprintf('No customer item with code "%1$s" found', $code));
     }
     return $item;
 }
开发者ID:aimeos,项目名称:ai-client-html,代码行数:14,代码来源:StandardTest.php

示例8: getBasket

 protected function getBasket()
 {
     $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
     $search = $customerManager->createSearch();
     $search->setConditions($search->compare('==', 'customer.code', 'UTC001'));
     $result = $customerManager->searchItems($search);
     if (($customer = reset($result)) === false) {
         throw new \Exception('Customer item not found');
     }
     $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $controller->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $customer->getPaymentAddress());
     $controller->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $customer->getPaymentAddress());
     return $controller->get();
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:14,代码来源:StandardTest.php

示例9: getCustomerData

 /**
  * Gets required customer item ids.
  *
  * @param array $keys List with referenced Ids
  * @return array $refIds List with referenced Ids
  * @throws \Aimeos\MW\Setup\Exception If no type ID is found
  */
 private function getCustomerData(array $keys)
 {
     $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Standard');
     $codes = array();
     foreach ($keys as $dataset) {
         if (($pos = strpos($dataset, '/')) === false || ($str = substr($dataset, $pos + 1)) === false) {
             throw new \Aimeos\MW\Setup\Exception(sprintf('Some keys for ref customer are set wrong "%1$s"', $dataset));
         }
         $codes[] = $str;
     }
     $search = $customerManager->createSearch();
     $search->setConditions($search->compare('==', 'customer.code', $codes));
     $refIds = array();
     foreach ($customerManager->searchItems($search) as $item) {
         $refIds['customer/' . $item->getCode()] = $item->getId();
     }
     return $refIds;
 }
开发者ID:aimeos,项目名称:aimeos-core,代码行数:25,代码来源:PriceListAddTestData.php

示例10: process

 /**
  * Adds the customer data
  *
  * @param string $path Path to data file
  * @throws \Aimeos\MShop\Exception
  */
 protected function process($path)
 {
     if (($testdata = (include $path)) == false) {
         throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path));
     }
     $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Standard');
     $customerAddressManager = $customerManager->getSubManager('address', 'Standard');
     $customerGroupManager = $customerManager->getSubManager('group', 'Standard');
     $search = $customerManager->createSearch();
     $search->setConditions($search->compare('=~', 'customer.code', 'UTC00'));
     $items = $customerManager->searchItems($search);
     $this->conn->begin();
     $customerManager->deleteItems(array_keys($items));
     $parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem());
     $this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds);
     $this->addCustomerGroupData($testdata, $customerGroupManager);
     $this->conn->commit();
 }
开发者ID:nos3,项目名称:aimeos-core,代码行数:24,代码来源:CustomerAddTestData.php

示例11: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $context = \TestHelper::getContext();
     $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context);
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'customer.code', 'UTC001'));
     $result = $manager->searchItems($search);
     if ((self::$customerItem = reset($result)) === false) {
         throw new \Exception('No customer found');
     }
     $manager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE')));
     foreach ($manager->searchItems($search, array('text', 'price', 'media')) as $id => $product) {
         $prices = $product->getRefItems('price', 'default', 'default');
         self::$productItems[$id]['price'] = reset($prices);
         self::$productItems[$id]['item'] = $product;
     }
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:19,代码来源:StandardTest.php

示例12: migrate

 /**
  * Adds attribute test data.
  */
 public function migrate()
 {
     $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
     if (!$this->additional instanceof $iface) {
         throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
     }
     $this->msg('Adding Laravel customer test data', 0);
     $this->additional->setEditor('ai-laravel:unittest');
     $parentIds = array();
     $ds = DIRECTORY_SEPARATOR;
     $path = __DIR__ . $ds . 'data' . $ds . 'customer.php';
     if (($testdata = (include $path)) == false) {
         throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path));
     }
     $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Laravel');
     $customerAddressManager = $customerManager->getSubManager('address', 'Laravel');
     $this->cleanupCustomerData($customerManager, $customerAddressManager);
     $this->conn->begin();
     $parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem());
     $this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds);
     $this->conn->commit();
     $this->status('done');
 }
开发者ID:aimeos,项目名称:ai-laravel,代码行数:26,代码来源:CustomerAddLaravelTestData.php

示例13: mysql

 /**
  * Adds attribute test data.
  */
 protected function mysql()
 {
     $iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
     if (!$this->additional instanceof $iface) {
         throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
     }
     $this->msg('Adding TYPO3 customer test data', 0);
     $this->additional->setEditor('ai-typo3:unittest');
     $parentIds = array();
     $ds = DIRECTORY_SEPARATOR;
     $path = __DIR__ . $ds . 'data' . $ds . 'customer.php';
     if (($testdata = (include $path)) == false) {
         throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path));
     }
     $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Typo3');
     $customerAddressManager = $customerManager->getSubManager('address', 'Typo3');
     foreach ($customerManager->searchItems($customerManager->createSearch()) as $id => $item) {
         $parentIds['customer/' . $item->getCode()] = $id;
     }
     $this->conn->begin();
     $this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds);
     $this->conn->commit();
     $this->status('done');
 }
开发者ID:aimeos,项目名称:ai-typo3,代码行数:27,代码来源:CustomerAddTypo3TestData.php

示例14: testUpdateAddress

 public function testUpdateAddress()
 {
     $context = \TestHelperMShop::getContext();
     $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context);
     $context->setUserId($customerManager->findItem('UTC001')->getId());
     $type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT;
     $this->plugin->setConfig(array('autofill.address' => '1'));
     $object = new \Aimeos\MShop\Plugin\Provider\Order\Autofill($context, $this->plugin);
     $this->assertTrue($object->update($this->order, 'addProduct.after'));
     $this->assertEquals(array(), $this->order->getServices());
     $this->assertEquals(1, count($this->order->getAddresses()));
     $this->assertInstanceOf('\\Aimeos\\MShop\\Order\\Item\\Base\\Address\\Iface', $this->order->getAddress($type));
 }
开发者ID:aimeos,项目名称:aimeos-core,代码行数:13,代码来源:AutofillTest.php

示例15: getBasket

 protected function getBasket()
 {
     $controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
     $customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
     $customer = $customerManager->findItem('UTC001');
     $controller->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $customer->getPaymentAddress());
     $controller->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $customer->getPaymentAddress());
     $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
     $product = $productManager->findItem('CNE');
     $controller->addProduct($product->getId(), 2, array(), array(), array(), array(), array(), 'default');
     $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
     $service = $serviceManager->findItem('unitpaymentcode', array(), 'service', 'payment');
     $controller->setService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, $service->getId());
     $service = $serviceManager->findItem('unitcode', array(), 'service', 'delivery');
     $controller->setService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY, $service->getId());
     return $controller->get();
 }
开发者ID:aimeos,项目名称:ai-client-html,代码行数:17,代码来源:StandardTest.php


注:本文中的Aimeos\MShop\Customer\Manager\Factory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。