Contao\CoreBundle\Routing\FrontendLoader::load PHP Method

load() public method

public load ( $resource, $type = null )
    public function load($resource, $type = null)
    {
        $routes = new RouteCollection();
        $defaults = ['_token_check' => true, '_controller' => 'ContaoCoreBundle:Frontend:index', '_scope' => ContaoCoreBundle::SCOPE_FRONTEND];
        $this->addFrontendRoute($routes, $defaults);
        $this->addIndexRoute($routes, $defaults);
        return $routes;
    }

Usage Example

 /**
  * Tests generating the "contao_index" route with missing locale.
  *
  * @expectedException \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
  */
 public function testGenerateIndexWithMissingLocale()
 {
     $loader = new FrontendLoader(true);
     $collection = $loader->load('.', 'bundles');
     $router = $this->getRouter($collection);
     $router->generate('contao_index');
 }