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


PHP Factory::injectManager方法代码示例

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


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

示例1: testRunExceptionProcess

 public function testRunExceptionProcess()
 {
     $context = \TestHelper::getContext();
     $aimeos = \TestHelper::getAimeos();
     $name = 'ControllerJobsServiceAsyncProcessDefaultRun';
     $context->getConfig()->set('mshop/service/manager/name', $name);
     $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);
     $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()));
     $object = new \Aimeos\Controller\Jobs\Order\Service\Async\Standard($context, $aimeos);
     $object->run();
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:14,代码来源:StandardTest.php

示例2: testUpdateNotAvailable

 public function testUpdateNotAvailable()
 {
     $context = \TestHelper::getContext();
     $object = new \Aimeos\MShop\Plugin\Provider\Order\ServicesUpdate($context, $this->plugin);
     $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
     $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
     $orderBaseProductManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product');
     $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service');
     $priceItem = $priceManager->createItem();
     $localeItem = $localeManager->createItem();
     $orderProduct = $orderBaseProductManager->createItem();
     $serviceDelivery = $orderBaseServiceManager->createItem();
     $serviceDelivery->setServiceId(1);
     $servicePayment = $orderBaseServiceManager->createItem();
     $servicePayment->setServiceId(2);
     $orderStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Item\\Base\\Standard')->setConstructorArgs(array($priceItem, $localeItem))->setMethods(array('getProducts'))->getMock();
     $serviceStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')->setConstructorArgs(array($context))->setMethods(array('searchItems', 'getProvider'))->getMock();
     \Aimeos\MShop\Service\Manager\Factory::injectManager('\\Aimeos\\MShop\\Service\\Manager\\PluginServicesUpdate', $serviceStub);
     $context->getConfig()->set('mshop/service/manager/name', 'PluginServicesUpdate');
     $orderStub->setService($serviceDelivery, 'delivery');
     $orderStub->setService($servicePayment, 'payment');
     $serviceItemDelivery = new \Aimeos\MShop\Service\Item\Standard(array('type' => 'delivery'));
     $serviceItemPayment = new \Aimeos\MShop\Service\Item\Standard(array('type' => 'payment'));
     $providerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Manual')->setConstructorArgs(array($context, $serviceStub->createItem()))->setMethods(array('isAvailable'))->getMock();
     $orderStub->expects($this->once())->method('getProducts')->will($this->returnValue(array($orderProduct)));
     $serviceStub->expects($this->once())->method('searchItems')->will($this->returnValue(array(1 => $serviceItemDelivery, 2 => $serviceItemPayment)));
     $serviceStub->expects($this->exactly(2))->method('getProvider')->will($this->returnValue($providerStub));
     $providerStub->expects($this->exactly(2))->method('isAvailable')->will($this->returnValue(false));
     $this->assertTrue($object->update($orderStub, 'addProduct.after'));
     $this->assertEquals(array(), $orderStub->getServices());
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:31,代码来源:ServicesUpdateTest.php


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