@@ -50,6 +50,17 @@ public function testConstructorRelativePath()
50
50
$ this ->assertSame ('/index.php/one/two ' , $ uri ->getPath ());
51
51
}
52
52
53
+ public function testConstructorRelativePathStartWithSlash ()
54
+ {
55
+ $ config = new App ();
56
+
57
+ $ uri = new SiteURI ($ config , '/one/two ' );
58
+
59
+ $ this ->assertSame ('http://example.com/index.php/one/two ' , (string ) $ uri );
60
+ $ this ->assertSame ('one/two ' , $ uri ->getRoutePath ());
61
+ $ this ->assertSame ('/index.php/one/two ' , $ uri ->getPath ());
62
+ }
63
+
53
64
public function testConstructorRelativePathWithQuery ()
54
65
{
55
66
$ config = new App ();
@@ -190,6 +201,22 @@ public function testSetPath()
190
201
$ this ->assertSame (2 , $ uri ->getTotalSegments ());
191
202
}
192
203
204
+ public function testSetPathStartWithSlash ()
205
+ {
206
+ $ config = new App ();
207
+
208
+ $ uri = new SiteURI ($ config );
209
+
210
+ $ uri ->setPath ('/test/method ' );
211
+
212
+ $ this ->assertSame ('http://example.com/index.php/test/method ' , (string ) $ uri );
213
+ $ this ->assertSame ('test/method ' , $ uri ->getRoutePath ());
214
+ $ this ->assertSame ('/index.php/test/method ' , $ uri ->getPath ());
215
+ $ this ->assertSame (['test ' , 'method ' ], $ uri ->getSegments ());
216
+ $ this ->assertSame ('test ' , $ uri ->getSegment (1 ));
217
+ $ this ->assertSame (2 , $ uri ->getTotalSegments ());
218
+ }
219
+
193
220
public function testSetPathSubfolder ()
194
221
{
195
222
$ config = new App ();
0 commit comments