Commit b4a88edd authored by catch's avatar catch

Issue #2052995 by dawehner: Add a route to the frontpage.

parent 193c7133
......@@ -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.
*
......
......@@ -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:
......
......@@ -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';
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment