function MatcherDumperTest::testAddRoutes

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php \Drupal\KernelTests\Core\Routing\MatcherDumperTest::testAddRoutes()
  2. 10 core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php \Drupal\KernelTests\Core\Routing\MatcherDumperTest::testAddRoutes()
  3. 11.x core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php \Drupal\KernelTests\Core\Routing\MatcherDumperTest::testAddRoutes()

Confirms that we can add routes to the dumper.

File

core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php, line 57

Class

MatcherDumperTest
Confirm that the matcher dumper is functioning properly.

Namespace

Drupal\KernelTests\Core\Routing

Code

public 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');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.