/**
  * @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();
 }
Exemple #2
0
 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());
 }