From 6f0bb29e7ab27f6bb0f86435764a48918f93b7ad Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 5 Sep 2015 01:04:35 +0300 Subject: [PATCH] Added test for #9596 --- tests/framework/web/UrlManagerTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/framework/web/UrlManagerTest.php b/tests/framework/web/UrlManagerTest.php index d4bb5a13e6..44352ee075 100644 --- a/tests/framework/web/UrlManagerTest.php +++ b/tests/framework/web/UrlManagerTest.php @@ -389,4 +389,23 @@ class UrlManagerTest extends TestCase unset($_SERVER['REQUEST_METHOD']); } + + /** + * Tests if hash-anchor present for + * + * https://github.com/yiisoft/yii2/pull/9596 + */ + public function testHash() + { + $manager = new UrlManager([ + 'enablePrettyUrl' => true, + 'cache' => null, + 'rules' => [ + ], + 'hostInfo' => 'http://example.com', + 'scriptUrl' => '/test', + ]); + $url = $manager->createAbsoluteUrl(['site/index', '#' => 'testhash']); + $this->assertEquals('http://example.com/test/site/index#testhash', $url); + } }