Ejemplo n.º 1
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);
     }
 }
Ejemplo n.º 2
0
 /**
  * Order throws exception while canceling
  */
 public function testException()
 {
     $exception = new \Exception('Can not cancel');
     $order1 = $this->getMockBuilder('Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->getMock();
     $this->orderCollectionMock->expects($this->any())->method('getItems')->willReturn([$order1]);
     $order1->expects($this->once())->method('canCancel')->willReturn(true);
     $order1->expects($this->once())->method('cancel')->willThrowException($exception);
     $this->messageManagerMock->expects($this->once())->method('addError')->with('Can not cancel');
     $this->massAction->execute();
 }
Ejemplo n.º 3
0
 /**
  * Order throws exception while canceling
  */
 public function testException()
 {
     $selected = [1];
     $exception = new \Exception('Can not cancel');
     $order1 = $this->getMockBuilder('Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->getMock();
     $this->requestMock->expects($this->at(0))->method('getParam')->with('selected')->willReturn($selected);
     $this->requestMock->expects($this->at(1))->method('getParam')->with('excluded')->willReturn([]);
     $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Sales\\Model\\Resource\\Order\\Grid\\Collection')->willReturn($this->orderCollectionMock);
     $this->orderCollectionMock->expects($this->once())->method('addFieldToFilter')->with(\Magento\Sales\Controller\Adminhtml\Order\MassCancel::ID_FIELD, ['in' => $selected]);
     $this->orderCollectionMock->expects($this->any())->method('getItems')->willReturn([$order1]);
     $order1->expects($this->once())->method('canCancel')->willReturn(true);
     $order1->expects($this->once())->method('cancel')->willThrowException($exception);
     $this->messageManagerMock->expects($this->once())->method('addError')->with('Can not cancel');
     $this->massAction->execute();
 }