function MockRouteProvider::getRouteCollectionForRequest

Same name in other branches
  1. 9 core/modules/system/src/Tests/Routing/MockRouteProvider.php \Drupal\system\Tests\Routing\MockRouteProvider::getRouteCollectionForRequest()
  2. 8.9.x core/modules/system/src/Tests/Routing/MockRouteProvider.php \Drupal\system\Tests\Routing\MockRouteProvider::getRouteCollectionForRequest()
  3. 11.x core/modules/system/src/Tests/Routing/MockRouteProvider.php \Drupal\system\Tests\Routing\MockRouteProvider::getRouteCollectionForRequest()

Implements \Drupal\Core\Routing\RouteProviderInterface::getRouteCollectionForRequest().

Simply return all routes to prevent \Symfony\Component\Routing\Exception\ResourceNotFoundException.

File

core/modules/system/src/Tests/Routing/MockRouteProvider.php, line 40

Class

MockRouteProvider
Easily configurable mock route provider.

Namespace

Drupal\system\Tests\Routing

Code

public function getRouteCollectionForRequest(Request $request) {
    return $this->routes;
}

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