/** * {@inheritdoc} */ public function execute() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'execute'); if (!$pluginInfo) { return parent::execute(); } else { return $this->___callPlugins('execute', func_get_args(), $pluginInfo); } }
/** * @return void */ public function testExecuteWithMessages() { $title = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Title')->disableOriginalConstructor()->getMock(); $title->expects($this->once())->method('set')->with('Shopping Cart'); $config = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Config')->disableOriginalConstructor()->getMock(); $config->expects($this->once())->method('getTitle')->willReturn($title); $page = $this->getMockBuilder('Magento\\Framework\\View\\Result\\Page')->disableOriginalConstructor()->getMock(); $page->expects($this->once())->method('getConfig')->willReturn($config); $this->resultPageFactory->expects($this->once())->method('create')->willReturn($page); $result = $this->controller->execute(); $this->assertInstanceOf('Magento\\Framework\\View\\Result\\Page', $result); }
public function testExecuteWithBadCouponAndNoItems() { $this->request->expects($this->at(0))->method('getParam')->with('remove')->willReturn(0); $this->request->expects($this->at(1))->method('getParam')->with('coupon_code')->willReturn('CODE'); $this->cart->expects($this->any())->method('getQuote')->willReturn($this->quote); $this->quote->expects($this->at(0))->method('getCouponCode')->willReturn('OLDCODE'); $this->quote->expects($this->any())->method('getItemsCount')->willReturn(0); $coupon = $this->getMock('Magento\\Quote\\Model\\Quote\\Address', [], [], '', false); $coupon->expects($this->once())->method('getId')->willReturn(0); $this->couponFactory->expects($this->once())->method('create')->willReturn($coupon); $this->messageManager->expects($this->once())->method('addError')->willReturnSelf(); $this->objectManagerMock->expects($this->once())->method('get')->willReturnSelf(); $this->controller->execute(); }