You are here

function MatcherDumperTest::testAddRoutes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Routing/MatcherDumperTest.php \Drupal\system\Tests\Routing\MatcherDumperTest::testAddRoutes()

Confirms that we can add routes to the dumper.

File

core/modules/system/src/Tests/Routing/MatcherDumperTest.php, line 61
Contains \Drupal\system\Tests\Routing\MatcherDumperTest.

Class

MatcherDumperTest
Confirm that the matcher dumper is functioning properly.

Namespace

Drupal\system\Tests\Routing

Code

function testAddRoutes() {
  $connection = Database::getConnection();
  $dumper = new MatcherDumper($connection, $this->state);
  $route = new Route('test');
  $collection = new RouteCollection();
  $collection
    ->add('test_route', $route);
  $dumper
    ->addRoutes($collection);
  $dumper_routes = $dumper
    ->getRoutes()
    ->all();
  $collection_routes = $collection
    ->all();
  foreach ($dumper_routes as $name => $route) {
    $this
      ->assertEqual($route
      ->getPath(), $collection_routes[$name]
      ->getPath(), 'Routes match');
  }
}