X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FTests%2FCore%2FRouting%2FMethodFilterTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FTests%2FCore%2FRouting%2FMethodFilterTest.php;h=2e411b2b85458bb726a4be70dfd6adae21100245;hp=8a7554dec903099e0a80bbc70f9e5973edc140b3;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php b/web/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php index 8a7554dec..2e411b2b8 100644 --- a/web/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php +++ b/web/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php @@ -15,34 +15,6 @@ use Symfony\Component\Routing\RouteCollection; */ class MethodFilterTest extends UnitTestCase { - /** - * @covers ::applies - * @dataProvider providerApplies - */ - public function testApplies(array $route_methods, $expected_applies) { - $route = new Route('/test', [], [], [], '', [], $route_methods); - $method_filter = new MethodFilter(); - - $this->assertSame($expected_applies, $method_filter->applies($route)); - } - - /** - * Data provider for testApplies(). - * - * @return array - */ - public function providerApplies() { - return [ - 'only GET' => [['GET'], TRUE], - 'only PATCH' => [['PATCH'], TRUE], - 'only POST' => [['POST'], TRUE], - 'only DELETE' => [['DELETE'], TRUE], - 'only HEAD' => [['HEAD'], TRUE], - 'all' => [['GET', 'PATCH', 'POST', 'DELETE', 'HEAD'], TRUE], - 'none' => [[], FALSE], - ]; - } - /** * @covers ::filter */ @@ -125,4 +97,22 @@ class MethodFilterTest extends UnitTestCase { $this->assertEquals($expected_collection, $result_collection); } + /** + * Ensures that the incoming and outgoing collections have the same order. + * + * @covers ::filter + */ + public function testCollectionOrder() { + $request = Request::create('/test', 'GET'); + + $collection = new RouteCollection(); + $collection->add('entity.taxonomy_term.canonical', new Route('/test')); + $collection->add('views.view.taxonomy_term_page', new Route('/test', [], [], [], '', [], ['GET', 'POST'])); + + $method_filter = new MethodFilter(); + $result_collection = $method_filter->filter($collection, $request); + + $this->assertEquals(['entity.taxonomy_term.canonical', 'views.view.taxonomy_term_page'], array_keys($result_collection->all())); + } + }