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


PHP Factory::injectManager方法代码示例

本文整理汇总了PHP中Aimeos\MShop\Order\Manager\Factory::injectManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::injectManager方法的具体用法?PHP Factory::injectManager怎么用?PHP Factory::injectManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aimeos\MShop\Order\Manager\Factory的用法示例。


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

示例1: testRunException

 public function testRunException()
 {
     $context = \TestHelper::getContext();
     $aimeos = \TestHelper::getAimeos();
     $mailStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\None')->disableOriginalConstructor()->getMock();
     $context->setMail($mailStub);
     $name = 'ControllerJobsEmailPaymentDefaultRun';
     $context->getConfig()->set('mshop/order/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')->setMethods(array('searchItems'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
     $orderItem = $orderManagerStub->createItem();
     $orderManagerStub->expects($this->exactly(4))->method('searchItems')->will($this->onConsecutiveCalls(array($orderItem), array(), array(), array()));
     $object = new \Aimeos\Controller\Jobs\Order\Email\Payment\Standard($context, $aimeos);
     $object->run();
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:15,代码来源:StandardTest.php

示例2: testUpdate

 public function testUpdate()
 {
     $context = \TestHelperCntl::getContext();
     $config = $context->getConfig();
     $name = 'ControllerCommonOrderBlock';
     $config->set('mshop/order/manager/name', $name);
     $config->set('mshop/product/manager/name', $name);
     $config->set('mshop/coupon/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')->setMethods(array('getSubManager'))->setConstructorArgs(array($context))->getMock();
     $orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setMethods(array('getSubManager'))->setConstructorArgs(array($context))->getMock();
     $orderStatusManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Status\\Standard')->setMethods(array('saveItem', 'searchItems'))->setConstructorArgs(array($context))->getMock();
     $orderProductManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Product\\Standard')->setMethods(array('searchItems'))->setConstructorArgs(array($context))->getMock();
     $orderCouponManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Coupon\\Standard')->setMethods(array('searchItems'))->setConstructorArgs(array($context))->getMock();
     $productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')->setMethods(array('getSubManager', 'searchItems'))->setConstructorArgs(array($context))->getMock();
     $productStockManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Stock\\Standard')->setMethods(array('increase'))->setConstructorArgs(array($context))->getMock();
     $couponManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Coupon\\Manager\\Standard')->setMethods(array('getSubManager'))->setConstructorArgs(array($context))->getMock();
     $couponCodeManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Coupon\\Manager\\Code\\Standard')->setMethods(array('increase'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
     \Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
     \Aimeos\MShop\Coupon\Manager\Factory::injectManager('\\Aimeos\\MShop\\Coupon\\Manager\\' . $name, $couponManagerStub);
     $orderStatusItemBlocked = $orderStatusManagerStub->createItem();
     $orderStatusItemBlocked->setValue(1);
     $orderStatusItemUnblocked = $orderStatusManagerStub->createItem();
     $orderStatusItemUnblocked->setValue(0);
     $orderManagerStub->expects($this->exactly(12))->method('getSubManager')->will($this->onConsecutiveCalls($orderStatusManagerStub, $orderBaseManagerStub, $orderStatusManagerStub, $orderStatusManagerStub, $orderBaseManagerStub, $orderStatusManagerStub, $orderStatusManagerStub, $orderBaseManagerStub, $orderStatusManagerStub, $orderStatusManagerStub, $orderBaseManagerStub, $orderStatusManagerStub));
     $orderBaseManagerStub->expects($this->exactly(4))->method('getSubManager')->will($this->onConsecutiveCalls($orderProductManagerStub, $orderCouponManagerStub, $orderProductManagerStub, $orderCouponManagerStub));
     $orderStatusManagerStub->expects($this->exactly(4))->method('searchItems')->will($this->onConsecutiveCalls(array($orderStatusItemUnblocked), array($orderStatusItemUnblocked), array($orderStatusItemBlocked), array($orderStatusItemBlocked)));
     $orderStatusManagerStub->expects($this->exactly(4))->method('saveItem');
     $orderProductManagerStub->expects($this->exactly(2))->method('searchItems')->will($this->returnValue(array($orderProductManagerStub->createItem())));
     $productManagerStub->expects($this->exactly(4))->method('getSubManager')->will($this->returnValue($productStockManagerStub));
     $productManagerStub->expects($this->exactly(2))->method('searchItems')->will($this->returnValue(array()));
     $productStockManagerStub->expects($this->exactly(2))->method('increase');
     $orderCouponManagerStub->expects($this->exactly(2))->method('searchItems')->will($this->returnValue(array($orderCouponManagerStub->createItem())));
     $couponManagerStub->expects($this->exactly(2))->method('getSubManager')->will($this->returnValue($couponCodeManagerStub));
     $couponCodeManagerStub->expects($this->exactly(2))->method('increase');
     $orderItem = $orderManagerStub->createItem();
     $orderItem->setPaymentStatus(\Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED);
     $object = new \Aimeos\Controller\Common\Order\Standard($context);
     $object->update($orderItem);
     $orderItem = $orderManagerStub->createItem();
     $orderItem->setPaymentStatus(\Aimeos\MShop\Order\Item\Base::PAY_PENDING);
     $object = new \Aimeos\Controller\Common\Order\Standard($context);
     $object->update($orderItem);
     $orderItem = $orderManagerStub->createItem();
     $orderItem->setPaymentStatus(\Aimeos\MShop\Order\Item\Base::PAY_DELETED);
     $object = new \Aimeos\Controller\Common\Order\Standard($context);
     $object->update($orderItem);
 }
开发者ID:nos3,项目名称:aimeos-core,代码行数:48,代码来源:StandardTest.php

示例3: testStore

 public function testStore()
 {
     $context = \TestHelper::getContext();
     $name = 'ControllerFrontendOrderStore';
     $context->getConfig()->set('mshop/order/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')->setMethods(array('saveItem', 'getSubManager'))->setConstructorArgs(array($context))->getMock();
     $orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setMethods(array('store'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
     $orderBaseItem = $orderBaseManagerStub->createItem();
     $orderBaseItem->setId(1);
     $orderBaseManagerStub->expects($this->once())->method('store');
     $orderManagerStub->expects($this->once())->method('getSubManager')->will($this->returnValue($orderBaseManagerStub));
     $orderManagerStub->expects($this->once())->method('saveItem');
     $object = new \Aimeos\Controller\Frontend\Order\Standard($context);
     $object->store($orderBaseItem);
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:16,代码来源:StandardTest.php

示例4: testRun

 public function testRun()
 {
     $context = \TestHelper::getContext();
     $aimeos = \TestHelper::getAimeos();
     $name = 'ControllerJobsOrderCleanupUnfinishedDefaultRun';
     $context->getConfig()->set('mshop/order/manager/name', $name);
     $context->getConfig()->set('controller/common/order/name', $name);
     $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')->setMethods(array('searchItems', 'getSubManager'))->setConstructorArgs(array($context))->getMock();
     $orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setMethods(array('deleteItems'))->setConstructorArgs(array($context))->getMock();
     $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')->setMethods(array('unblock'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
     \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
     $orderItem = $orderManagerStub->createItem();
     $orderItem->setBaseId(1);
     $orderItem->setId(2);
     $orderManagerStub->expects($this->once())->method('getSubManager')->will($this->returnValue($orderBaseManagerStub));
     $orderManagerStub->expects($this->once())->method('searchItems')->will($this->returnValue(array($orderItem->getId() => $orderItem)));
     $orderBaseManagerStub->expects($this->once())->method('deleteItems');
     $orderCntlStub->expects($this->once())->method('unblock');
     $object = new \Aimeos\Controller\Jobs\Order\Cleanup\Unfinished\Standard($context, $aimeos);
     $object->run();
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:22,代码来源:StandardTest.php

示例5: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @access protected
  */
 protected function setUp()
 {
     $this->context = \TestHelper::getContext();
     $serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
     $search = $serviceManager->createSearch();
     $search->setConditions($search->compare('==', 'service.code', 'paypalexpress'));
     $serviceItems = $serviceManager->searchItems($search);
     if (($this->serviceItem = reset($serviceItems)) === false) {
         throw new \Exception('No paypalexpress service item available');
     }
     $this->object = new \Aimeos\MShop\Service\Provider\Payment\PayPalExpress($this->context, $this->serviceItem);
     $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($this->context);
     $search = $orderManager->createSearch();
     $expr = array($search->compare('==', 'order.type', \Aimeos\MShop\Order\Item\Base::TYPE_WEB), $search->compare('==', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED));
     $search->setConditions($search->combine('&&', $expr));
     $orderItems = $orderManager->searchItems($search);
     if (($this->order = reset($orderItems)) === false) {
         throw new \Exception(sprintf('No Order found with statuspayment "%1$s" and type "%2$s"', \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED, \Aimeos\MShop\Order\Item\Base::TYPE_WEB));
     }
     $this->context->getConfig()->set('mshop/order/manager/name', 'MockPayPal');
     $orderMock = $this->getMock('\\Aimeos\\MShop\\Order\\Manager\\Standard', array('saveItem'), array($this->context));
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\MockPayPal', $orderMock);
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:29,代码来源:PayPalExpressTest.php

示例6: testRunExceptionProvider

 public function testRunExceptionProvider()
 {
     $context = \TestHelperJobs::getContext();
     $aimeos = \TestHelperJobs::getAimeos();
     $name = 'ControllerJobsServicePaymentProcessDefaultRun';
     $context->getConfig()->set('mshop/service/manager/name', $name);
     $context->getConfig()->set('mshop/order/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')->setMethods(array('saveItem', 'searchItems'))->setConstructorArgs(array($context))->getMock();
     $serviceManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')->setMethods(array('getProvider', 'searchItems'))->setConstructorArgs(array($context))->getMock();
     \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\' . $name, $serviceManagerStub);
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
     $serviceItem = $serviceManagerStub->createItem();
     $serviceManagerStub->expects($this->once())->method('searchItems')->will($this->onConsecutiveCalls(array($serviceItem), array()));
     $serviceManagerStub->expects($this->once())->method('getProvider')->will($this->throwException(new \Aimeos\MShop\Service\Exception('test service delivery process: getProvider')));
     $orderManagerStub->expects($this->never())->method('searchItems');
     $object = new \Aimeos\Controller\Jobs\Order\Service\Payment\Standard($context, $aimeos);
     $object->run();
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:18,代码来源:StandardTest.php

示例7: testPostBulk

 public function testPostBulk()
 {
     $name = 'ControllerJsonAdmStandard';
     $this->context->getConfig()->set('mshop/product/manager/name', $name);
     $productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')->setMethods(array('getItem', 'saveItem'))->setConstructorArgs(array($this->context))->getMock();
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
     $item = $productManagerStub->createItem();
     $item->setLabel('test');
     $item->setId('-1');
     $productManagerStub->expects($this->exactly(2))->method('saveItem');
     $productManagerStub->expects($this->exactly(2))->method('getItem')->will($this->returnValue($item));
     $body = '{"data": [{"type": "product", "attributes": {"product.label": "test"}}, {"type": "product", "attributes": {"product.label": "test"}}]}';
     $header = array();
     $status = 500;
     $result = json_decode($this->object->post($body, $header, $status), true);
     $this->assertEquals(201, $status);
     $this->assertEquals(1, count($header));
     $this->assertEquals(2, $result['meta']['total']);
     $this->assertArrayHasKey('data', $result);
     $this->assertEquals(2, count($result['data']));
     $this->assertEquals('-1', $result['data'][0]['id']);
     $this->assertEquals('product', $result['data'][0]['type']);
     $this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
     $this->assertArrayNotHasKey('included', $result);
     $this->assertArrayNotHasKey('errors', $result);
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:26,代码来源:StandardTest.php

示例8: tearDown

 protected function tearDown()
 {
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\StandardMock', null);
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:4,代码来源:WeightTest.php

示例9: testIsAvailableLimitTooMuch

 public function testIsAvailableLimitTooMuch()
 {
     $this->context->setUserId(1);
     $this->context->getConfig()->set('mshop/order/manager/name', 'StandardMock');
     $this->servItem->setConfig(array('ordercheck.limit-days-pending' => 1));
     $mock = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('searchItems'))->getMock();
     $mock->expects($this->once())->method('searchItems')->will($this->returnValue(array($mock->createItem())));
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\StandardMock', $mock);
     $this->assertFalse($this->object->isAvailable($this->basket));
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:10,代码来源:OrderCheckTest.php

示例10: testUpdateOrderService

 public function testUpdateOrderService()
 {
     $context = \TestHelperMShop::getContext();
     $manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'customer.code', 'UTC001'));
     $result = $manager->searchItems($search);
     if (($customer = reset($result)) === false) {
         throw new \RuntimeException('No customer item for code UTC001" found');
     }
     $orderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')->setConstructorArgs(array($context))->setMethods(array('getSubManager'))->getMock();
     $orderBaseStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setConstructorArgs(array($context))->setMethods(array('getSubManager'))->getMock();
     $orderBaseServiceStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Service\\Standard')->setConstructorArgs(array($context))->setMethods(array('searchItems'))->getMock();
     $item1 = $orderBaseServiceStub->createItem();
     $item1->setType(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY);
     $item1->setCode('unitcode');
     $item2 = $orderBaseServiceStub->createItem();
     $item2->setType(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT);
     $item2->setCode('unitpaymentcode');
     $orderStub->expects($this->any())->method('getSubManager')->will($this->returnValue($orderBaseStub));
     $orderBaseStub->expects($this->any())->method('getSubManager')->will($this->returnValue($orderBaseServiceStub));
     $orderBaseServiceStub->expects($this->once())->method('searchItems')->will($this->returnValue(array($item1, $item2)));
     \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\PluginAutofill', $orderStub);
     $context->getConfig()->set('mshop/order/manager/name', 'PluginAutofill');
     $context->setUserId($customer->getId());
     $this->plugin->setConfig(array('autofill.useorder' => '1', 'autofill.orderaddress' => '0', 'autofill.orderservice' => '1'));
     $object = new \Aimeos\MShop\Plugin\Provider\Order\Autofill($context, $this->plugin);
     $this->assertTrue($object->update($this->order, 'addProduct.after'));
     $this->assertEquals(2, count($this->order->getServices()));
     $this->assertEquals(array(), $this->order->getAddresses());
 }
开发者ID:aimeos,项目名称:aimeos-core,代码行数:31,代码来源:AutofillTest.php


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