public function ExceptionHandlerTest::testStatusCode

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php, line 42

Class

ExceptionHandlerTest

Namespace

Symfony\Component\HttpKernel\Tests\Debug

Code

public function testStatusCode() {
  $handler = new ExceptionHandler(false);
  $response = $handler
    ->createResponse(new \RuntimeException('Foo'));
  $this
    ->assertEquals('500', $response
    ->getStatusCode());
  $this
    ->assertContains('<title>Whoops, looks like something went wrong.</title>', $response
    ->getContent());
  $response = $handler
    ->createResponse(new NotFoundHttpException('Foo'));
  $this
    ->assertEquals('404', $response
    ->getStatusCode());
  $this
    ->assertContains('<title>Sorry, the page you are looking for could not be found.</title>', $response
    ->getContent());
}