File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ public function __construct(
125125
126126 // Set routePath
127127 $ parts = explode ('? ' , $ relativePath );
128+ $ parts = explode ('# ' , $ parts [0 ]);
128129 $ routePath = $ parts [0 ];
129130 $ this ->setRoutePath ($ routePath );
130131 }
Original file line number Diff line number Diff line change @@ -58,6 +58,30 @@ public function testConstructorRelativePathWithQuery()
5858 $ this ->assertSame ('foo=1&bar=2 ' , $ uri ->getQuery ());
5959 }
6060
61+ public function testConstructorRelativePathWithFragment ()
62+ {
63+ $ config = new App ();
64+
65+ $ uri = new SiteURI ($ config , 'one/two#sec1 ' );
66+
67+ $ this ->assertSame ('http://example.com/index.php/one/two#sec1 ' , (string ) $ uri );
68+ $ this ->assertSame ('/index.php/one/two ' , $ uri ->getPath ());
69+ $ this ->assertSame ('' , $ uri ->getQuery ());
70+ $ this ->assertSame ('sec1 ' , $ uri ->getFragment ());
71+ }
72+
73+ public function testConstructorRelativePathWithQueryAndFragment ()
74+ {
75+ $ config = new App ();
76+
77+ $ uri = new SiteURI ($ config , 'one/two?foo=1&bar=2#sec1 ' );
78+
79+ $ this ->assertSame ('http://example.com/index.php/one/two?foo=1&bar=2#sec1 ' , (string ) $ uri );
80+ $ this ->assertSame ('/index.php/one/two ' , $ uri ->getPath ());
81+ $ this ->assertSame ('foo=1&bar=2 ' , $ uri ->getQuery ());
82+ $ this ->assertSame ('sec1 ' , $ uri ->getFragment ());
83+ }
84+
6185 public function testConstructorHost ()
6286 {
6387 $ config = new App ();
You can’t perform that action at this time.
0 commit comments