withPath() public method

public withPath ( $path )
Example #1
0
 /**
  * @group 48
  */
 public function testWithPathReturnsSameInstanceWhenPathDoesNotChange()
 {
     $uri = new Uri('http://example.com/test/path');
     $test = $uri->withPath('/test/path');
     $this->assertSame($uri, $test);
 }
Example #2
0
 public function testPathNotSlashPrefixedIsEmittedWithSlashDelimiterWhenUriIsCastToString()
 {
     $uri = new Uri('http://example.com');
     $new = $uri->withPath('foo/bar');
     $this->assertEquals('http://example.com/foo/bar', $new->__toString());
 }
Example #3
0
 public function testPathIsPrefixedWithSlashIfSetWithoutOne()
 {
     $uri = new Uri('http://example.com');
     $new = $uri->withPath('foo/bar');
     $this->assertEquals('/foo/bar', $new->getPath());
 }