function RouteProviderTest::testMixedCasePaths
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testMixedCasePaths()
- 8.9.x core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testMixedCasePaths()
- 11.x core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testMixedCasePaths()
Confirms that we find routes using a case-insensitive path match.
@dataProvider providerMixedCaseRoutePaths
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Routing/ RouteProviderTest.php, line 236
Class
- RouteProviderTest
- Confirm that the default route provider is working correctly.
Namespace
Drupal\KernelTests\Core\RoutingCode
public function testMixedCasePaths($path, $expected_route_name, $method = 'GET') : 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
->mixedCaseRouteCollection());
$dumper->dump();
$request = Request::create($path, $method);
$routes = $provider->getRouteCollectionForRequest($request);
if ($expected_route_name) {
$this->assertCount(1, $routes, 'The correct number of routes was found.');
$this->assertNotNull($routes->get($expected_route_name), 'The first matching route was found.');
}
else {
$this->assertCount(0, $routes, 'No routes matched.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.