function ExceptionHandlingTest::test406

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php \Drupal\KernelTests\Core\Routing\ExceptionHandlingTest::test406()

Tests a route with a non-supported _format parameter.

File

core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php, line 50

Class

ExceptionHandlingTest
Tests the exception handling for various cases.

Namespace

Drupal\KernelTests\Core\Routing

Code

public function test406() : void {
    $request = Request::create('/router_test/test2?_format=non_existent_format');
    
    /** @var \Symfony\Component\HttpKernel\HttpKernelInterface $kernel */
    $kernel = \Drupal::getContainer()->get('http_kernel');
    $response = $kernel->handle($request);
    $this->assertEquals(Response::HTTP_NOT_ACCEPTABLE, $response->getStatusCode());
}

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