當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。