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


PHP MShop_Order_Manager_Factory::injectManager方法代码示例

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


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

示例1: testRunException

 public function testRunException()
 {
     $context = TestHelper::getContext();
     $arcavias = TestHelper::getArcavias();
     $mailStub = $this->getMockBuilder('MW_Mail_None')->disableOriginalConstructor()->getMock();
     $context->setMail($mailStub);
     $name = 'ControllerJobsEmailDeliveryDefaultRun';
     $context->getConfig()->set('classes/order/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('MShop_Order_Manager_Default')->setMethods(array('searchItems'))->setConstructorArgs(array($context))->getMock();
     MShop_Order_Manager_Factory::injectManager('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 Controller_Jobs_Order_Email_Delivery_Default($context, $arcavias);
     $object->run();
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:15,代码来源:DefaultTest.php

示例2: testStore

 public function testStore()
 {
     $context = TestHelper::getContext();
     $name = 'ControllerFrontendOrderStore';
     $context->getConfig()->set('classes/order/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('MShop_Order_Manager_Default')->setMethods(array('saveItem', 'getSubManager'))->setConstructorArgs(array($context))->getMock();
     $orderBaseManagerStub = $this->getMockBuilder('MShop_Order_Manager_Base_Default')->setMethods(array('store'))->setConstructorArgs(array($context))->getMock();
     MShop_Order_Manager_Factory::injectManager('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 Controller_Frontend_Order_Default($context);
     $object->store($orderBaseItem);
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:16,代码来源:DefaultTest.php

示例3: testUpdate

 public function testUpdate()
 {
     $context = TestHelper::getContext();
     $config = $context->getConfig();
     $name = 'ControllerCommonOrderBlock';
     $config->set('classes/order/manager/name', $name);
     $config->set('classes/product/manager/name', $name);
     $config->set('classes/coupon/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('MShop_Order_Manager_Default')->setMethods(array('getSubManager'))->setConstructorArgs(array($context))->getMock();
     $orderBaseManagerStub = $this->getMockBuilder('MShop_Order_Manager_Base_Default')->setMethods(array('getSubManager'))->setConstructorArgs(array($context))->getMock();
     $orderStatusManagerStub = $this->getMockBuilder('MShop_Order_Manager_Status_Default')->setMethods(array('saveItem', 'searchItems'))->setConstructorArgs(array($context))->getMock();
     $orderProductManagerStub = $this->getMockBuilder('MShop_Order_Manager_Base_Product_Default')->setMethods(array('searchItems'))->setConstructorArgs(array($context))->getMock();
     $orderCouponManagerStub = $this->getMockBuilder('MShop_Order_Manager_Base_Coupon_Default')->setMethods(array('searchItems'))->setConstructorArgs(array($context))->getMock();
     $productManagerStub = $this->getMockBuilder('MShop_Product_Manager_Default')->setMethods(array('getSubManager'))->setConstructorArgs(array($context))->getMock();
     $productStockManagerStub = $this->getMockBuilder('MShop_Product_Manager_Stock_Default')->setMethods(array('increase'))->setConstructorArgs(array($context))->getMock();
     $couponManagerStub = $this->getMockBuilder('MShop_Coupon_Manager_Default')->setMethods(array('getSubManager'))->setConstructorArgs(array($context))->getMock();
     $couponCodeManagerStub = $this->getMockBuilder('MShop_Coupon_Manager_Code_Default')->setMethods(array('increase'))->setConstructorArgs(array($context))->getMock();
     MShop_Order_Manager_Factory::injectManager('MShop_Order_Manager_' . $name, $orderManagerStub);
     MShop_Order_Manager_Factory::injectManager('MShop_Product_Manager_' . $name, $productManagerStub);
     MShop_Order_Manager_Factory::injectManager('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(2))->method('getSubManager')->will($this->returnValue($productStockManagerStub));
     $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(MShop_Order_Item_Abstract::PAY_UNFINISHED);
     $object = new Controller_Common_Order_Default($context);
     $object->update($orderItem);
     $orderItem = $orderManagerStub->createItem();
     $orderItem->setPaymentStatus(MShop_Order_Item_Abstract::PAY_PENDING);
     $object = new Controller_Common_Order_Default($context);
     $object->update($orderItem);
     $orderItem = $orderManagerStub->createItem();
     $orderItem->setPaymentStatus(MShop_Order_Item_Abstract::PAY_DELETED);
     $object = new Controller_Common_Order_Default($context);
     $object->update($orderItem);
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:47,代码来源:DefaultTest.php

示例4: testRun

 public function testRun()
 {
     $context = TestHelper::getContext();
     $arcavias = TestHelper::getArcavias();
     $name = 'ControllerJobsOrderCleanupUnpaidDefaultRun';
     $context->getConfig()->set('classes/order/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('MShop_Order_Manager_Default')->setMethods(array('searchItems', 'getSubManager'))->setConstructorArgs(array($context))->getMock();
     $orderBaseManagerStub = $this->getMockBuilder('MShop_Order_Manager_Base_Default')->setMethods(array('deleteItems'))->setConstructorArgs(array($context))->getMock();
     MShop_Order_Manager_Factory::injectManager('MShop_Order_Manager_' . $name, $orderManagerStub);
     $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');
     $object = new Controller_Jobs_Order_Cleanup_Unpaid_Default($context, $arcavias);
     $object->run();
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:18,代码来源:DefaultTest.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 = 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 MShop_Service_Provider_Payment_PayPalExpress($this->_context, $this->_serviceItem);
     $orderManager = MShop_Order_Manager_Factory::createManager($this->_context);
     $search = $orderManager->createSearch();
     $expr = array($search->compare('==', 'order.type', MShop_Order_Item_Abstract::TYPE_WEB), $search->compare('==', 'order.statuspayment', MShop_Order_Item_Abstract::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"', MShop_Order_Item_Abstract::PAY_AUTHORIZED, MShop_Order_Item_Abstract::TYPE_WEB));
     }
     $this->_context->getConfig()->set('classes/order/manager/name', 'MockPayPal');
     $orderMock = $this->getMock('MShop_Order_Manager_Default', array('saveItem'), array($this->_context));
     MShop_Order_Manager_Factory::injectManager('MShop_Order_Manager_MockPayPal', $orderMock);
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:29,代码来源:PayPalExpressTest.php

示例6: testIsAvailableLimitTooMuch

 public function testIsAvailableLimitTooMuch()
 {
     $this->_context->setUserId(1);
     $this->_context->getConfig()->set('classes/order/manager/name', 'DefaultMock');
     $this->_servItem->setConfig(array('ordercheck.limit-days-pending' => 1));
     $mock = $this->getMockBuilder('MShop_Order_Manager_Default')->setConstructorArgs(array($this->_context))->setMethods(array('searchItems'))->getMock();
     $mock->expects($this->once())->method('searchItems')->will($this->returnValue(array($mock->createItem())));
     MShop_Order_Manager_Factory::injectManager('MShop_Order_Manager_DefaultMock', $mock);
     $this->assertFalse($this->_object->isAvailable($this->_basket));
 }
开发者ID:Bananamoon,项目名称:aimeos-core,代码行数:10,代码来源:OrderCheckTest.php

示例7: testUpdateOrderService

 public function testUpdateOrderService()
 {
     $context = TestHelper::getContext();
     $manager = 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 Exception('No customer item for code UTC001" found');
     }
     $orderStub = $this->getMockBuilder('MShop_Order_Manager_Default')->setConstructorArgs(array($context))->setMethods(array('getSubManager'))->getMock();
     $orderBaseStub = $this->getMockBuilder('MShop_Order_Manager_Base_Default')->setConstructorArgs(array($context))->setMethods(array('getSubManager'))->getMock();
     $orderBaseServiceStub = $this->getMockBuilder('MShop_Order_Manager_Base_Service_Default')->setConstructorArgs(array($context))->setMethods(array('searchItems'))->getMock();
     $item1 = $orderBaseServiceStub->createItem();
     $item1->setType(MShop_Order_Item_Base_Service_Abstract::TYPE_DELIVERY);
     $item1->setCode('unitcode');
     $item2 = $orderBaseServiceStub->createItem();
     $item2->setType(MShop_Order_Item_Base_Service_Abstract::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)));
     MShop_Order_Manager_Factory::injectManager('MShop_Order_Manager_PluginAutofill', $orderStub);
     $context->getConfig()->set('classes/order/manager/name', 'PluginAutofill');
     $context->setUserId($customer->getId());
     $this->_plugin->setConfig(array('autofill.useorder' => '1', 'autofill.orderaddress' => '0', 'autofill.orderservice' => '1'));
     $object = new 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:arcavias,项目名称:arcavias-core,代码行数:31,代码来源:AutofillTest.php

示例8: testRunExceptionProvider

 public function testRunExceptionProvider()
 {
     $context = TestHelper::getContext();
     $arcavias = TestHelper::getArcavias();
     $name = 'ControllerJobsServiceDeliveryProcessDefaultRun';
     $context->getConfig()->set('classes/service/manager/name', $name);
     $context->getConfig()->set('classes/order/manager/name', $name);
     $orderManagerStub = $this->getMockBuilder('MShop_Order_Manager_Default')->setMethods(array('saveItem', 'searchItems'))->setConstructorArgs(array($context))->getMock();
     $serviceManagerStub = $this->getMockBuilder('MShop_Service_Manager_Default')->setMethods(array('getProvider', 'searchItems'))->setConstructorArgs(array($context))->getMock();
     MShop_Service_Manager_Factory::injectManager('MShop_Service_Manager_' . $name, $serviceManagerStub);
     MShop_Order_Manager_Factory::injectManager('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 MShop_Service_Exception('test sorder service delivery: getProvider')));
     $orderManagerStub->expects($this->never())->method('searchItems');
     $object = new Controller_Jobs_Order_Service_Delivery_Default($context, $arcavias);
     $object->run();
 }
开发者ID:arcavias,项目名称:arcavias-core,代码行数:18,代码来源:DefaultTest.php


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