/**
  * {@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);
     }
 }
 public function testExecuteNoReleasedOrderFromHold()
 {
     $order1 = $this->getMockBuilder('Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->getMock();
     $order2 = $this->getMockBuilder('Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->getMock();
     $orders = [$order1, $order2];
     $this->orderCollectionMock->expects($this->any())->method('getItems')->willReturn($orders);
     $order1->expects($this->once())->method('canUnhold')->willReturn(false);
     $this->orderCollectionMock->expects($this->once())->method('count')->willReturn(count($orders));
     $order2->expects($this->once())->method('canUnhold')->willReturn(false);
     $this->messageManagerMock->expects($this->once())->method('addError')->with('No order(s) were released from on hold status.');
     $this->resultRedirectMock->expects($this->once())->method('setPath')->with('sales/*/')->willReturnSelf();
     $this->massAction->execute();
 }
Exemple #3
0
 public function testExecuteOneOrderWhereNotReleasedFromHold()
 {
     $excluded = [1, 2];
     $countOrders = count($excluded);
     $order1 = $this->getMockBuilder('Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->getMock();
     $order2 = $this->getMockBuilder('Magento\\Sales\\Model\\Order')->disableOriginalConstructor()->getMock();
     $this->requestMock->expects($this->at(0))->method('getParam')->with('selected')->willReturn([]);
     $this->requestMock->expects($this->at(1))->method('getParam')->with('excluded')->willReturn($excluded);
     $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, ['nin' => $excluded]);
     $this->orderCollectionMock->expects($this->any())->method('getItems')->willReturn([$order1, $order2]);
     $order1->expects($this->once())->method('canUnhold')->willReturn(false);
     $this->orderCollectionMock->expects($this->once())->method('count')->willReturn($countOrders);
     $order2->expects($this->once())->method('canUnhold')->willReturn(false);
     $this->messageManagerMock->expects($this->once())->method('addError')->with('No order(s) were released from on hold status.');
     $this->resultRedirectMock->expects($this->once())->method('setPath')->with('sales/*/')->willReturnSelf();
     $this->massAction->execute();
 }