Esempio n. 1
0
 /**
  * Test execute
  *
  * @return void
  */
 public function testExecuteNotValidPost()
 {
     $redirectMock = $this->getMockBuilder('Magento\\Backend\\Model\\View\\Result\\Redirect')->disableOriginalConstructor()->getMock();
     $this->resultPageFactoryMock->expects($this->once())->method('create')->willReturn($redirectMock);
     $this->formKeyValidatorMock->expects($this->once())->method('validate')->with($this->requestMock)->willReturn(true);
     $this->requestMock->expects($this->once())->method('isPost')->willReturn(false);
     $this->messageManagerMock->expects($this->once())->method('addError')->with('We can\'t save the invoice right now.');
     $redirectMock->expects($this->once())->method('setPath')->with('sales/order/index')->willReturnSelf();
     $this->assertEquals($redirectMock, $this->controller->execute());
 }
Esempio n. 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);
     }
 }