function MethodFilterTest::testFilteredMethods
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php \Drupal\Tests\Core\Routing\MethodFilterTest::testFilteredMethods()
- 10 core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php \Drupal\Tests\Core\Routing\MethodFilterTest::testFilteredMethods()
- 11.x core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php \Drupal\Tests\Core\Routing\MethodFilterTest::testFilteredMethods()
@covers ::filter
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ MethodFilterTest.php, line 84
Class
- MethodFilterTest
- @coversDefaultClass \Drupal\Core\Routing\MethodFilter @group Routing
Namespace
Drupal\Tests\Core\RoutingCode
public function testFilteredMethods() {
$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', [], [], [], '', [], [
'PATCH',
]));
$collection->add('test_route3.get', new Route('/test', [], [], [], '', [], [
'POST',
]));
$expected_collection = new RouteCollection();
$expected_collection->add('test_route2.get', new Route('/test', [], [], [], '', [], [
'PATCH',
]));
$method_filter = new MethodFilter();
$result_collection = $method_filter->filter($collection, $request);
$this->assertEquals($expected_collection, $result_collection);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.