コード例 #1
0
ファイル: PsrUriTest.php プロジェクト: im286er/windwalker
 /**
  * testWithPath
  *
  * @return  void
  */
 public function testWithPath()
 {
     $uri = new PsrUri('https://*****:*****@local.example.com:3001/foo?bar=baz#quz');
     $new = $uri->withPath('/bar/baz');
     $this->assertNotSame($uri, $new);
     $this->assertEquals('/bar/baz', $new->getPath());
     $this->assertEquals('https://*****:*****@local.example.com:3001/bar/baz?bar=baz#quz', (string) $new);
     $uri = new PsrUri('http://example.com');
     $new = $uri->withPath('foo/bar');
     $this->assertEquals('foo/bar', $new->getPath());
     $uri = new PsrUri('http://example.com');
     $new = $uri->withPath('foo/bar');
     $this->assertEquals('http://example.com/foo/bar', $new->__toString());
     // Encoded
     $uri = $uri->withPath('/foo^bar');
     $expected = '/foo%5Ebar';
     $this->assertEquals($expected, $uri->getPath());
     // Not double encoded
     $uri = $uri->withPath('/foo%5Ebar');
     $expected = '/foo%5Ebar';
     $this->assertEquals($expected, $uri->getPath());
 }