function MatcherDumperTest::testAddAdditionalRoutes
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php \Drupal\KernelTests\Core\Routing\MatcherDumperTest::testAddAdditionalRoutes()
- 8.9.x core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php \Drupal\KernelTests\Core\Routing\MatcherDumperTest::testAddAdditionalRoutes()
- 10 core/tests/Drupal/KernelTests/Core/Routing/MatcherDumperTest.php \Drupal\KernelTests\Core\Routing\MatcherDumperTest::testAddAdditionalRoutes()
Confirms that we can add routes to the dumper when it already has some.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Routing/ MatcherDumperTest.php, line 94
Class
- MatcherDumperTest
- Confirm that the matcher dumper is functioning properly.
Namespace
Drupal\KernelTests\Core\RoutingCode
public function testAddAdditionalRoutes() : void {
$connection = Database::getConnection();
$dumper = new MatcherDumper($connection, $this->state, $this->logger);
$route = new Route('test');
$collection = new RouteCollection();
$collection->add('test_route', $route);
$dumper->addRoutes($collection);
$route = new Route('test2');
$collection2 = new RouteCollection();
$collection2->add('test_route2', $route);
$dumper->addRoutes($collection2);
// Merge the two collections together so we can test them.
$collection->addCollection(clone $collection2);
$dumper_routes = $dumper->getRoutes()
->all();
$collection_routes = $collection->all();
foreach ($collection_routes as $name => $route) {
$this->assertNotEmpty($dumper_routes[$name], "Route {$name} should be present in the dumper.");
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.