function RequestFormatRouteFilterTest::testFilter

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php \Drupal\Tests\Core\Routing\RequestFormatRouteFilterTest::testFilter()
  2. 10 core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php \Drupal\Tests\Core\Routing\RequestFormatRouteFilterTest::testFilter()
  3. 11.x core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php \Drupal\Tests\Core\Routing\RequestFormatRouteFilterTest::testFilter()

@covers ::filter @dataProvider filterProvider

File

core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php, line 25

Class

RequestFormatRouteFilterTest
@coversDefaultClass \Drupal\Core\Routing\RequestFormatRouteFilter @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public function testFilter(RouteCollection $collection, $request_format, array $expected_filtered_collection) {
    $route_filter = new RequestFormatRouteFilter();
    $request = new Request();
    $request->setRequestFormat($request_format);
    $collection = $route_filter->filter($collection, $request);
    $this->assertCount(count($expected_filtered_collection), $collection);
    $this->assertSame($expected_filtered_collection, array_keys($collection->all()));
}

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