/** * @expectedException \Exception * @expectedExceptionMessage Message */ public function testLaunchException() { $this->_frontControllerMock->expects($this->once())->method('dispatch')->with($this->_requestMock)->will($this->returnCallback(function () { throw new \Exception('Message'); })); $this->_http->launch(); }
public function testCatchExceptionSessionException() { $this->responseMock->expects($this->once())->method('setRedirect'); $this->responseMock->expects($this->once())->method('sendHeaders'); $bootstrap = $this->getMock('Magento\\Framework\\App\\Bootstrap', [], [], '', false); $bootstrap->expects($this->once())->method('isDeveloperMode')->willReturn(false); $this->assertTrue($this->http->catchException($bootstrap, new \Magento\Framework\Exception\SessionException(new \Magento\Framework\Phrase('Test')))); }
public function testLaunchDispatchException() { $this->_frontControllerMock->expects($this->once())->method('dispatch')->with($this->_requestMock)->will($this->returnCallback(function () { throw new \Exception('Message'); })); $this->_stateMock->expects($this->once())->method('getMode')->will($this->returnValue(\Magento\Framework\App\State::MODE_DEVELOPER)); $this->_responseMock->expects($this->once())->method('setHttpResponseCode')->with(500); $this->_responseMock->expects($this->once())->method('setBody')->with($this->matchesRegularExpression('/Message[\\n]+<pre>Message[\\n]*(.|\\n)*<\\/pre>/')); $this->assertSame($this->_responseMock, $this->_http->launch()); }
public function testCheckAdvancedAcceptingByPaymentMethod() { $this->initLayoutMock(); $this->initOrderMock(self::LAST_REAL_ORDER_ID, Order::STATE_NEW); $this->initCheckoutSessionMock(self::LAST_REAL_ORDER_ID, true); $this->requestMock->expects($this->once())->method('getParam')->with('RESPMSG')->will($this->returnValue('message')); $this->blockMock->expects($this->at(0))->method('setData')->with('goto_section', 'paymentMethod')->will($this->returnSelf()); $this->blockMock->expects($this->at(1))->method('setData')->with('error_msg', __('Your payment has been declined. Please try again.'))->will($this->returnSelf()); $this->paymentMock->expects($this->once())->method('getMethod')->will($this->returnValue(Config::METHOD_PAYFLOWADVANCED)); $payflowadvancedReturnUrl = new PayflowadvancedReturnUrl($this->contextMock, $this->checkoutSessionMock, $this->orderFactoryMock, $this->payflowlinkFactoryMock, $this->helperCheckoutMock, $this->loggerMock); $payflowadvancedReturnUrl->execute(); }