function RoutingFixtures::complexRouteCollection

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::complexRouteCollection()
  2. 10 core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::complexRouteCollection()
  3. 11.x core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::complexRouteCollection()

Returns a complex set of routes for testing.

Return value

\Symfony\Component\Routing\RouteCollection

File

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

Class

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

Namespace

Drupal\Tests\Core\Routing

Code

public function complexRouteCollection() {
    $collection = new RouteCollection();
    $route = new Route('/path/{thing}/one');
    $route->setMethods([
        'GET',
    ]);
    $collection->add('route_a', $route);
    $route = new Route('/path/{thing}/one');
    $route->setMethods([
        'PUT',
    ]);
    $collection->add('route_b', $route);
    $route = new Route('/somewhere/{item}/over/the/rainbow');
    $route->setMethods([
        'GET',
    ]);
    $collection->add('route_c', $route);
    $route = new Route('/another/{thing}/about/{item}');
    $collection->add('route_d', $route);
    $route = new Route('/path/add/one');
    $route->setMethods([
        'GET',
        'HEAD',
    ]);
    $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.