function RouteProviderTest::testOutlinePathMatchZero
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testOutlinePathMatchZero()
- 8.9.x core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testOutlinePathMatchZero()
- 11.x core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testOutlinePathMatchZero()
Tests a route with a 0 as value.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Routing/ RouteProviderTest.php, line 512
Class
- RouteProviderTest
- Confirm that the default route provider is working correctly.
Namespace
Drupal\KernelTests\Core\RoutingCode
public function testOutlinePathMatchZero() : void {
$connection = Database::getConnection();
$provider = new RouteProvider($connection, $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');
$this->fixtures
->createTables($connection);
$collection = new RouteCollection();
$collection->add('foo', new Route('/some/path/{value}'));
$dumper = new MatcherDumper($connection, $this->state, $this->logger, 'test_routes');
$dumper->addRoutes($collection);
$dumper->dump();
$path = '/some/path/0';
$request = Request::create($path, 'GET');
try {
$routes = $provider->getRouteCollectionForRequest($request);
// All of the matching paths have the correct pattern.
foreach ($routes as $route) {
$this->assertEquals('/some/path/%', $route->compile()
->getPatternOutline(), 'Found path has correct pattern');
}
$this->assertCount(1, $routes, 'The correct number of routes was found.');
} catch (ResourceNotFoundException $e) {
$this->fail('No matchout route found with 0 as argument value');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.