public function RouteProviderTest::testOutlinePathNoMatch in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php \Drupal\KernelTests\Core\Routing\RouteProviderTest::testOutlinePathNoMatch()
Confirms that an exception is thrown when no matching path is found.
File
- core/tests/ Drupal/ KernelTests/ Core/ Routing/ RouteProviderTest.php, line 544 
- Contains \Drupal\KernelTests\Core\Routing\RouteProviderTest.
Class
- RouteProviderTest
- Confirm that the default route provider is working correctly.
Namespace
Drupal\KernelTests\Core\RoutingCode
public 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
    ->assertEmpty($routes, 'No path found with this pattern.');
  $collection = $provider
    ->getRouteCollectionForRequest($request);
  $this
    ->assertEmpty($collection, 'Empty route collection found with this pattern.');
}