public function RoutingFixtures::contentRouteCollection in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::contentRouteCollection()
- 9 core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::contentRouteCollection()
Returns a Content-type restricted set of routes for testing.
Return value
\Symfony\Component\Routing\RouteCollection
File
- core/
tests/ Drupal/ Tests/ Core/ Routing/ RoutingFixtures.php, line 219
Class
- RoutingFixtures
- Utility methods to generate sample data, database configuration, etc.
Namespace
Drupal\Tests\Core\RoutingCode
public function contentRouteCollection() {
$collection = new RouteCollection();
$route = new Route('path/three');
$route
->setMethods([
'POST',
]);
$route
->setRequirement('_content_type_format', 'json');
$collection
->add('route_f', $route);
$route = new Route('path/three');
$route
->setMethods([
'PATCH',
]);
$route
->setRequirement('_content_type_format', 'xml');
$collection
->add('route_g', $route);
return $collection;
}