public function testProcess() { $type = MShop_Order_Item_Base_Address_Abstract::TYPE_PAYMENT; $manager = 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('*****@*****.**'); $basketCntl = Controller_Frontend_Basket_Factory::createController($this->_context); $basketCntl->setAddress($type, $addrItem); $view = TestHelper::getView(); $view->orderBasket = $basketCntl->get(); $this->_object->setView($view); $orderBaseStub = $this->getMockBuilder('MShop_Order_Manager_Base_Default')->setConstructorArgs(array($this->_context))->setMethods(array('saveItem'))->getMock(); $customerStub = $this->getMockBuilder('MShop_Customer_Manager_Default')->setConstructorArgs(array($this->_context))->setMethods(array('saveItem'))->getMock(); $orderBaseStub->expects($this->once())->method('saveItem'); $customerStub->expects($this->once())->method('saveItem'); MShop_Factory::injectManager($this->_context, 'customer', $customerStub); MShop_Factory::injectManager($this->_context, 'order/base', $orderBaseStub); $this->_object->process(); }
public function testRun() { $stub = $this->getMockBuilder('MShop_Product_Manager_List_Default')->setConstructorArgs(array($this->_context))->setMethods(array('deleteItems', 'saveItem'))->getMock(); MShop_Factory::injectManager($this->_context, 'product/list', $stub); $stub->expects($this->atLeastOnce())->method('deleteItems'); $stub->expects($this->atLeastOnce())->method('saveItem'); $this->_object->run(); }
public function testProcessDirectDebit() { $mock = $this->getMockBuilder('MShop_Order_Manager_Base_Default')->setConstructorArgs(array($this->_context))->setMethods(array('store'))->getMock(); MShop_Factory::injectManager($this->_context, 'order/base', $mock); $view = $this->_object->getView(); $param = array('c_step' => 'process'); $helper = new MW_View_Helper_Parameter_Default($view, $param); $view->addHelper('param', $helper); $orderid = $this->_getOrder('2009-03-18 16:14:32')->getId(); $this->_context->getSession()->set('arcavias/orderid', $orderid); $this->_object->process(); $this->assertEquals(0, count($view->get('standardErrorList', array()))); $this->assertEquals('POST', $view->standardMethod); $this->assertEquals(array(), $view->standardProcessParams); $this->assertEquals(true, $view->standardUrlExternal); $this->assertEquals('http://baseurl/checkout/standard/?c_step=payment', $view->standardUrlPayment); }