public function RouterTest::testLeadingSlashes in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Routing/RouterTest.php \Drupal\system\Tests\Routing\RouterTest::testLeadingSlashes()
Ensure that multiple leading slashes are redirected.
File
- core/
modules/ system/ src/ Tests/ Routing/ RouterTest.php, line 288 - Contains \Drupal\system\Tests\Routing\RouterTest.
Class
- RouterTest
- Functional class for the full integrated routing system.
Namespace
Drupal\system\Tests\RoutingCode
public function testLeadingSlashes() {
$request = $this->container
->get('request_stack')
->getCurrentRequest();
$url = $request
->getUriForPath('//router_test/test1');
$this
->drupalGet($url);
$this
->assertEqual(1, $this->redirectCount, $url . " redirected to " . $this->url);
$this
->assertUrl($request
->getUriForPath('/router_test/test1'));
// It should not matter how many leading slashes are used and query strings
// should be preserved.
$url = $request
->getUriForPath('/////////////////////////////////////////////////router_test/test1') . '?qs=test';
$this
->drupalGet($url);
$this
->assertEqual(1, $this->redirectCount, $url . " redirected to " . $this->url);
$this
->assertUrl($request
->getUriForPath('/router_test/test1') . '?qs=test');
}