function MethodFilterTest::testMethodNotAllowedExceptionWithMultipleRoutes

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php \Drupal\Tests\Core\Routing\MethodFilterTest::testMethodNotAllowedExceptionWithMultipleRoutes()
  2. 10 core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php \Drupal\Tests\Core\Routing\MethodFilterTest::testMethodNotAllowedExceptionWithMultipleRoutes()
  3. 11.x core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php \Drupal\Tests\Core\Routing\MethodFilterTest::testMethodNotAllowedExceptionWithMultipleRoutes()

@covers ::filter

File

core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php, line 68

Class

MethodFilterTest
@coversDefaultClass \Drupal\Core\Routing\MethodFilter[[api-linebreak]] @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public function testMethodNotAllowedExceptionWithMultipleRoutes() {
  $request = Request::create('/test', 'PATCH');
  $collection = new RouteCollection();
  $collection->add('test_route.get', new Route('/test', [], [], [], '', [], [
    'GET',
  ]));
  $collection->add('test_route2.get', new Route('/test', [], [], [], '', [], [
    'GET',
  ]));
  $collection->add('test_route3.get', new Route('/test', [], [], [], '', [], [
    'GET',
  ]));
  $this->expectException(MethodNotAllowedException::class);
  $method_filter = new MethodFilter();
  $method_filter->filter($collection, $request);
}

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