function MethodFilterTest::testWithAllowedMethodAndMultipleMatchingRoutes

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

@covers ::filter

File

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

Class

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

Namespace

Drupal\Tests\Core\Routing

Code

public function testWithAllowedMethodAndMultipleMatchingRoutes() : void {
  $request = Request::create('/test', 'GET');
  $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',
  ]));
  $collection_before = clone $collection;
  $method_filter = new MethodFilter();
  $result_collection = $method_filter->filter($collection, $request);
  $this->assertEquals($collection_before, $result_collection);
}

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