/** * Test that when a {@link Sonno\Application\WebApplicationException} is * thrown, the Exception's constructor argument is used as the Response entity. * * @return void * @runInSeparateProcess */ public function testWebApplicationExceptionContentEntity() { $exception = new WebApplicationException(404, '<p>Entity not found!</p>'); $dispatcher = $this->getMock('Sonno\\Dispatcher\\Dispatcher'); $dispatcher->expects($this->any())->method('dispatch')->will($this->throwException($exception)); $config = $this->buildMockConfiguration(array(array('path' => '/test/123', 'httpMethod' => 'GET', 'produces' => array('text/html')))); $request = $this->buildMockRequest('GET', '/test/123', null, new Variant(null, null, 'text/html')); $app = new Application($config); $app->setDispatcher($dispatcher); $response = $app->run($request); $this->assertEquals('<p>Entity not found!</p>', $response->getContent()); $this->assertEquals(404, $response->getStatusCode()); }