public function RouteProviderTest::testGetRoutesPaged in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testGetRoutesPaged()
Tests getRoutesPaged().
File
- core/
tests/ Drupal/ KernelTests/ Core/ Routing/ RouteProviderTest.php, line 709 - Contains \Drupal\KernelTests\Core\Routing\RouteProviderTest.
Class
- RouteProviderTest
- Confirm that the default route provider is working correctly.
Namespace
Drupal\KernelTests\Core\RoutingCode
public function testGetRoutesPaged() {
$connection = Database::getConnection();
$provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');
$this->fixtures
->createTables($connection);
$dumper = new MatcherDumper($connection, $this->state, 'test_routes');
$dumper
->addRoutes($this->fixtures
->sampleRouteCollection());
$dumper
->dump();
$fixture_routes = $this->fixtures
->staticSampleRouteCollection();
// Query all the routes.
$routes = $provider
->getRoutesPaged(0);
$this
->assertEqual(array_keys($routes), array_keys($fixture_routes));
// Query non routes.
$routes = $provider
->getRoutesPaged(0, 0);
$this
->assertEqual(array_keys($routes), []);
// Query a limited sets of routes.
$routes = $provider
->getRoutesPaged(1, 2);
$this
->assertEqual(array_keys($routes), array_slice(array_keys($fixture_routes), 1, 2));
}