public function MatcherDumperTest::testAddAdditionalRoutes in Drupal 9
Same name and namespace in other branches
- 8 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 78
Class
- MatcherDumperTest
- Confirm that the matcher dumper is functioning properly.
Namespace
Drupal\KernelTests\Core\RoutingCode
public function testAddAdditionalRoutes() {
$connection = Database::getConnection();
$dumper = new MatcherDumper($connection, $this->state);
$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.");
}
}