function ExceptionHandlingTest::testExceptionResponseGeneratedForOriginalRequest

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php \Drupal\KernelTests\Core\Routing\ExceptionHandlingTest::testExceptionResponseGeneratedForOriginalRequest()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php \Drupal\KernelTests\Core\Routing\ExceptionHandlingTest::testExceptionResponseGeneratedForOriginalRequest()
  3. 10 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 128

Class

ExceptionHandlingTest
Tests the exception handling for various cases.

Namespace

Drupal\KernelTests\Core\Routing

Code

public function testExceptionResponseGeneratedForOriginalRequest() : void {
    // 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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.