function RoutingFixtures::sampleRouteCollection
Returns a standard set of routes for testing.
Return value
\Symfony\Component\Routing\RouteCollection
File
- 
              core/
tests/ Drupal/ Tests/ Core/ Routing/ RoutingFixtures.php, line 87  
Class
- RoutingFixtures
 - Utility methods to generate sample data, database configuration, etc.
 
Namespace
Drupal\Tests\Core\RoutingCode
public function sampleRouteCollection() {
  $collection = new RouteCollection();
  $route = new Route('path/one');
  $route->setMethods([
    'GET',
  ]);
  $collection->add('route_a', $route);
  $route = new Route('path/one');
  $route->setMethods([
    'PUT',
  ]);
  $collection->add('route_b', $route);
  $route = new Route('path/two');
  $route->setMethods([
    'GET',
  ]);
  $route->setRequirement('_format', 'json');
  $collection->add('route_c', $route);
  $route = new Route('path/three');
  $collection->add('route_d', $route);
  $route = new Route('path/two');
  $route->setMethods([
    'GET',
    'HEAD',
  ]);
  $route->setRequirement('_format', 'html');
  $collection->add('route_e', $route);
  return $collection;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.