function RouteProviderTest::testDuplicateRoutePaths
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testDuplicateRoutePaths()
- 8.9.x core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testDuplicateRoutePaths()
- 10 core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testDuplicateRoutePaths()
Confirms that we find all routes with the same path.
@dataProvider providerDuplicateRoutePaths
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Routing/ RouteProviderTest.php, line 279
Class
- RouteProviderTest
- Confirm that the default route provider is working correctly.
Namespace
Drupal\KernelTests\Core\RoutingCode
public function testDuplicateRoutePaths($path, $number, $expected_route_name = NULL) : void {
$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, $this->logger, 'test_routes');
$dumper->addRoutes($this->fixtures
->duplicatePathsRouteCollection());
$dumper->dump();
$request = Request::create($path);
$routes = $provider->getRouteCollectionForRequest($request);
$this->assertCount($number, $routes, 'The correct number of routes was found.');
if ($expected_route_name) {
$route_name = $routes->getIterator()
->key();
$this->assertEquals($expected_route_name, $route_name, 'The expected route name was found.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.