You are here

function RouteProviderTest::testExactPathMatch in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Tests/Routing/RouteProviderTest.php \Drupal\system\Tests\Routing\RouteProviderTest::testExactPathMatch()

Confirms that we can find routes with the exact incoming path.

File

core/modules/system/src/Tests/Routing/RouteProviderTest.php, line 139
Contains \Drupal\system\Tests\Routing\RouteProviderTest.

Class

RouteProviderTest
Confirm that the default route provider is working correctly.

Namespace

Drupal\system\Tests\Routing

Code

function testExactPathMatch() {
  $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
    ->sampleRouteCollection());
  $dumper
    ->dump();
  $path = '/path/one';
  $request = Request::create($path, 'GET');
  $routes = $provider
    ->getRouteCollectionForRequest($request);
  foreach ($routes as $route) {
    $this
      ->assertEqual($route
      ->getPath(), $path, 'Found path has correct pattern');
  }
}