Exemplo n.º 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->execute());
 }
Exemplo n.º 2
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());
 }