public function ExceptionHandlingTest::testHtml403 in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Routing/ExceptionHandlingTest.php \Drupal\system\Tests\Routing\ExceptionHandlingTest::testHtml403()
Tests the exception handling for HTML and 403 status code.
File
- core/
modules/ system/ src/ Tests/ Routing/ ExceptionHandlingTest.php, line 74 - Contains \Drupal\system\Tests\Routing\ExceptionHandlingTest.
Class
- ExceptionHandlingTest
- Tests the exception handling for various cases.
Namespace
Drupal\system\Tests\RoutingCode
public function testHtml403() {
$request = Request::create('/router_test/test15');
$request
->setFormat('html', [
'text/html',
]);
/** @var \Symfony\Component\HttpKernel\HttpKernelInterface $kernel */
$kernel = \Drupal::getContainer()
->get('http_kernel');
$response = $kernel
->handle($request)
->prepare($request);
$this
->assertEqual($response
->getStatusCode(), Response::HTTP_FORBIDDEN);
$this
->assertEqual($response->headers
->get('Content-type'), 'text/html; charset=UTF-8');
}