function RouteProvider::lazyLoadItself

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::lazyLoadItself()
  2. 10 core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::lazyLoadItself()
  3. 11.x core/tests/Drupal/KernelTests/RouteProvider.php \Drupal\KernelTests\RouteProvider::lazyLoadItself()

Loads the real route provider from the container and rebuilds the router.

Return value

\Drupal\Core\Routing\PreloadableRouteProviderInterface|\Symfony\Cmf\Component\Routing\PagedRouteProviderInterface|\Symfony\Component\EventDispatcher\EventSubscriberInterface The route provider.

File

core/tests/Drupal/KernelTests/RouteProvider.php, line 22

Class

RouteProvider
Rebuilds the router when the provider is instantiated.

Namespace

Drupal\KernelTests

Code

protected function lazyLoadItself() {
    if (!isset($this->service)) {
        $container = \Drupal::getContainer();
        $this->service = $container->get('simpletest.router.route_provider');
        $container->get('router.builder')
            ->rebuild();
    }
    return $this->service;
}

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