/** * @covers \Magento\Sales\Controller\Adminhtml\Order\View::executeInternal */ public function testGlobalException() { $id = 111; $exception = new \Exception(); $this->initOrder(); $this->initOrderSuccess($id); $this->prepareRedirect(); $this->resultPageFactoryMock->expects($this->once()) ->method('create') ->willThrowException($exception); $this->loggerMock->expects($this->once()) ->method('critical') ->with($exception); $this->messageManagerMock->expects($this->once()) ->method('addError') ->with('Exception occurred during order load') ->willReturnSelf(); $this->setPath('sales/order/index'); $this->assertInstanceOf( 'Magento\Backend\Model\View\Result\Redirect', $this->viewAction->executeInternal() ); }