public function RoutingFixtures::staticSampleRouteCollection in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::staticSampleRouteCollection()
 
Returns a static version of the routes.
File
- core/
tests/ Drupal/ Tests/ Core/ Routing/ RoutingFixtures.php, line 49  
Class
- RoutingFixtures
 - Utility methods to generate sample data, database configuration, etc.
 
Namespace
Drupal\Tests\Core\RoutingCode
public function staticSampleRouteCollection() {
  $routes = [];
  $routes['route_a'] = [
    'path' => '/path/one',
    'methods' => [
      'GET',
    ],
  ];
  $routes['route_b'] = [
    'path' => '/path/one',
    'methods' => [
      'PUT',
    ],
  ];
  $routes['route_c'] = [
    'path' => '/path/two',
    'methods' => [
      'GET',
    ],
    'requirements' => [
      '_format' => 'json',
    ],
  ];
  $routes['route_d'] = [
    'path' => '/path/three',
  ];
  $routes['route_e'] = [
    'path' => '/path/two',
    'methods' => [
      'GET',
      'HEAD',
    ],
    'requirements' => [
      '_format' => 'html',
    ],
  ];
  return $routes;
}