function RoutingFixtures::staticSampleRouteCollection

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::staticSampleRouteCollection()
  2. 8.9.x core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::staticSampleRouteCollection()
  3. 11.x 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 51

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.