Ejemplo n.º 1
0
 public function testExecuteException()
 {
     $html = '<script>window.location.href = ' . self::REVIEW_URL . ';</script>';
     $shippingMethod = 'flat_rate';
     $this->requestMock->expects($this->at(0))->method('getParam')->with('isAjax')->willReturn(true);
     $this->requestMock->expects($this->at(1))->method('getParam')->with('shipping_method')->willReturn($shippingMethod);
     $this->setupCart();
     $exceptionMsg = new \Magento\Framework\Phrase('error');
     $exception = new \Magento\Framework\Exception\LocalizedException($exceptionMsg);
     $this->checkoutMock->expects($this->once())->method('updateShippingMethod')->with($shippingMethod)->willThrowException($exception);
     $this->messageManager->expects($this->once())->method('addExceptionMessage')->with($exception, $exceptionMsg);
     $this->responseMock->expects($this->once())->method('setBody')->with($html);
     $this->controller->executeInternal();
 }