You are here

public function RoutingFixtures::mixedCaseRouteCollection in Drupal 10

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

Returns a complex set of routes for testing.

Return value

\Symfony\Component\Routing\RouteCollection

File

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

Class

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

Namespace

Drupal\Tests\Core\Routing

Code

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

  // Uses Hebrew letter QOF (U+05E7)
  // cSpell:disable-next-line
  $route = new Route('/somewhere/{item}/over/the/קainbow');
  $route
    ->setMethods([
    'GET',
  ]);
  $collection
    ->add('route_c', $route);
  $route = new Route('/another/{thing}/aboUT/{item}');
  $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_e', $route);
  return $collection;
}