diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Routing/RouterTest.php index 1cd383e..aebdc95 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Routing/RouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Routing/RouterTest.php @@ -8,6 +8,7 @@ namespace Drupal\system\Tests\Routing; use Drupal\simpletest\WebTestBase; +use Symfony\Component\Routing\RequestContext; /** * Functional class for the full integrated routing system. @@ -143,6 +144,25 @@ public function testControllerResolutionPage() { } /** + * Checks the generate method on the url generator using the front router. + */ + public function testUrlGeneratorFront() { + // Setup the request context of the url generator. Note: Just calling the + // code without a proper request, does not setup the request context + // automatically. + $context = new RequestContext(); + $context->fromRequest($this->container->get('request')); + $this->container->get('url_generator')->setContext($context); + + global $base_path; + $this->assertEqual(1, $base_path); + $this->assertEqual(1, $context->getBaseUrl()); + + $this->assertEqual($this->container->get('url_generator')->generate('front'), $base_path); + $this->assertEqual($this->container->get('url_generator')->generateFromPath(''), $base_path); + } + + /** * Checks that an ajax request gets rendered as an Ajax response, by mime. * * @todo This test will not work until the Ajax enhancer is corrected. However, diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 61363d6..be35f3f 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -220,3 +220,8 @@ system_plugin_autocomplete: _controller: 'Drupal\system\Controller\SystemController::autocomplete' requirements: _access_system_plugin_ui: 'TRUE' + +front: + pattern: '/' + requirements: + _access: 'TRUE'