You are here

public function MethodFilterTest::testWithAllowedMethodAndMultipleMatchingRoutes in Drupal 8

Same name and namespace in other branches
  1. 9 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 36

Class

MethodFilterTest
@coversDefaultClass \Drupal\Core\Routing\MethodFilter @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public function testWithAllowedMethodAndMultipleMatchingRoutes() {
  $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);
}