You are here

public function RoutingFixtures::staticSampleRouteCollection in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::staticSampleRouteCollection()
  2. 10 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\Routing

Code

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;
}