function MethodFilterTest::testWithAllowedMethodAndMultipleMatchingRoutes

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

Tests with allowed method and multiple matching routes.

@legacy-covers ::filter

File

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

Class

MethodFilterTest
Tests Drupal\Core\Routing\MethodFilter.

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.