Example #1
0
    public function testEmailNoOrderId()
    {
        $this->request->expects($this->once())
            ->method('getParam')
            ->with('order_id')
            ->will($this->returnValue(null));
        $this->orderRepositoryMock->expects($this->once())
            ->method('get')
            ->with(null)
            ->willThrowException(
                new \Magento\Framework\Exception\NoSuchEntityException(__('Requested entity doesn\'t exist'))
            );
        $this->messageManager->expects($this->once())
            ->method('addError')
            ->with('This order no longer exists.');

        $this->actionFlag->expects($this->once())
            ->method('set')
            ->with('', 'no-dispatch', true)
            ->will($this->returnValue(true));
        $this->resultRedirect->expects($this->once())
            ->method('setPath')
            ->with('sales/*/')
            ->willReturnSelf();

        $this->assertInstanceOf(
            'Magento\Backend\Model\View\Result\Redirect',
            $this->orderEmail->executeInternal()
        );
    }
Example #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);
     }
 }
Example #3
0
 public function testEmailNoOrderId()
 {
     $orderClassName = 'Magento\\Sales\\Model\\Order';
     $order = $this->getMock($orderClassName, ['load', 'getId', '__wakeup'], [], '', false);
     $this->request->expects($this->once())->method('getParam')->with('order_id')->will($this->returnValue(null));
     $this->objectManager->expects($this->at(0))->method('create')->with($orderClassName)->will($this->returnValue($order));
     $order->expects($this->once())->method('load')->with(null)->will($this->returnSelf());
     $this->messageManager->expects($this->once())->method('addError')->with('This order no longer exists.');
     $this->actionFlag->expects($this->once())->method('set')->with('', 'no-dispatch', true)->will($this->returnValue(true));
     $this->resultRedirect->expects($this->once())->method('setPath')->with('sales/*/')->willReturnSelf();
     $this->assertInstanceOf('Magento\\Backend\\Model\\View\\Result\\Redirect', $this->orderEmail->execute());
 }