public function ExceptionHandlingTest::test405 in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php \Drupal\KernelTests\Core\Routing\ExceptionHandlingTest::test405()
- 10 core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php \Drupal\KernelTests\Core\Routing\ExceptionHandlingTest::test405()
Tests on a route with a non-supported HTTP method.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Routing/ ExceptionHandlingTest.php, line 35
Class
- ExceptionHandlingTest
- Tests the exception handling for various cases.
Namespace
Drupal\KernelTests\Core\RoutingCode
public function test405() {
$request = Request::create('/router_test/test15', 'PATCH');
/** @var \Symfony\Component\HttpKernel\HttpKernelInterface $kernel */
$kernel = \Drupal::getContainer()
->get('http_kernel');
$response = $kernel
->handle($request);
$this
->assertEquals(Response::HTTP_METHOD_NOT_ALLOWED, $response
->getStatusCode());
}