Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getResponse()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getResponse');
     if (!$pluginInfo) {
         return parent::getResponse();
     } else {
         return $this->___callPlugins('getResponse', func_get_args(), $pluginInfo);
     }
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch');
     if (!$pluginInfo) {
         return parent::dispatch($request);
     } else {
         return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo);
     }
 }
Пример #3
0
 /**
  * @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);
 }
Пример #4
0
 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->executeInternal();
 }