function RouteProviderTest::testOutlinePathNoMatch in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Routing/RouteProviderTest.php \Drupal\system\Tests\Routing\RouteProviderTest::testOutlinePathNoMatch()
Confirms that an exception is thrown when no matching path is found.
File
- core/
modules/ system/ src/ Tests/ Routing/ RouteProviderTest.php, line 411 - Contains \Drupal\system\Tests\Routing\RouteProviderTest.
Class
- RouteProviderTest
- Confirm that the default route provider is working correctly.
Namespace
Drupal\system\Tests\RoutingCode
function testOutlinePathNoMatch() {
$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
->complexRouteCollection());
$dumper
->dump();
$path = '/no/such/path';
$request = Request::create($path, 'GET');
$routes = $provider
->getRoutesByPattern($path);
$this
->assertFalse(count($routes), 'No path found with this pattern.');
$collection = $provider
->getRouteCollectionForRequest($request);
$this
->assertTrue(count($collection) == 0, 'Empty route collection found with this pattern.');
}