You are here

public function RoutingFixtures::duplicatePathsRouteCollection in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::duplicatePathsRouteCollection()

Returns a complex set of routes for testing.

Return value

\Symfony\Component\Routing\RouteCollection

File

core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php, line 181

Class

RoutingFixtures
Utility methods to generate sample data, database configuration, etc.

Namespace

Drupal\Tests\Core\Routing

Code

public function duplicatePathsRouteCollection() {
  $collection = new RouteCollection();
  $route = new Route('/path/one');
  $route
    ->setMethods([
    'GET',
  ]);
  $collection
    ->add('route_b', $route);

  // Add the routes not in order by route name.
  $route = new Route('/path/one');
  $route
    ->setMethods([
    'GET',
  ]);
  $collection
    ->add('route_a', $route);
  $route = new Route('/path/one');
  $route
    ->setMethods([
    'GET',
  ]);
  $collection
    ->add('route_c', $route);
  $route = new Route('/path/TWO');
  $route
    ->setMethods([
    'GET',
  ]);
  $collection
    ->add('route_d', $route);

  // Greek letters lower case phi (U+03C6) and lower case omega (U+03C9)
  // cSpell:disable-next-line
  $route = new Route('/place/meφω');
  $route
    ->setMethods([
    'GET',
    'HEAD',
  ]);
  $collection
    ->add('route_f', $route);

  // cSpell:disable-next-line
  $route = new Route('/PLACE/meφω');
  $collection
    ->add('route_e', $route);
  return $collection;
}