public function ExceptionHandlingTest::testExceptionResponseGeneratedForOriginalRequest in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php \Drupal\KernelTests\Core\Routing\ExceptionHandlingTest::testExceptionResponseGeneratedForOriginalRequest()
Tests that the exception response is executed in the original context.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Routing/ ExceptionHandlingTest.php, line 113
Class
- ExceptionHandlingTest
- Tests the exception handling for various cases.
Namespace
Drupal\KernelTests\Core\RoutingCode
public function testExceptionResponseGeneratedForOriginalRequest() {
// Test with 404 path pointing to a route that uses '_controller'.
$response = $this
->doTest404Route('/router_test/test25');
$this
->assertStringContainsString('/not-found', $response
->getContent());
// Test with 404 path pointing to a route that uses '_form'.
$response = $this
->doTest404Route('/router_test/test26');
$this
->assertStringContainsString('<form class="system-logging-settings"', $response
->getContent());
// Test with 404 path pointing to a route that uses '_entity_form'.
$response = $this
->doTest404Route('/router_test/test27');
$this
->assertStringContainsString('<form class="date-format-add-form date-format-form"', $response
->getContent());
}