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 1cd383e82b3608fe8e1ce8f9be721d580357e9a6..6d62243584ecc5b06c7f6910a876bf8a6993d5ed 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. @@ -142,6 +143,24 @@ public function testControllerResolutionPage() { $this->assertNoPattern('#</body>.*</body>#s', 'There was no double-page effect from a misrendered subrequest.'); } + /** + * 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')->setRequest($this->container->get('request')); + $this->container->get('url_generator')->setContext($context); + + global $base_path; + + $this->assertEqual($this->container->get('url_generator')->generate('<front>'), $base_path); + $this->assertEqual($this->container->get('url_generator')->generateFromPath('<front>'), $base_path); + } + /** * Checks that an ajax request gets rendered as an Ajax response, by mime. * diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 254bf01d95984eb38ee9cdf62c22d158d711529d..f12ba8aa275167df39c38eceb3fce414f861e1a6 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -202,6 +202,11 @@ system_theme_settings_global: requirements: _permission: 'administer themes' +'<front>': + pattern: '/' + requirements: + _access: 'TRUE' + system_modules_uninstall: pattern: 'admin/modules/uninstall' defaults: diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 49b1a4476e8ee715e2e70a6a3afc692be03a51eb..091af6ca9fff021dd5f17c71f44e4c1e291a457e 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -304,6 +304,7 @@ function simpletest_script_init($server_software) { $_SERVER['REQUEST_URI'] = $path .'/'; $_SERVER['REQUEST_METHOD'] = 'GET'; $_SERVER['SCRIPT_NAME'] = $path .'/index.php'; + $_SERVER['SCRIPT_FILENAME'] = $path .'/index.php'; $_SERVER['PHP_SELF'] = $path .'/index.php'; $_SERVER['HTTP_USER_AGENT'] = 'Drupal command line';