示例#1
0
 public function testGetRelative()
 {
     $url = new \r8\URL();
     $this->assertNull($url->getRelative());
     $url->setPath("/path/to/file.php");
     $this->assertSame("/path/to/file.php", $url->getRelative());
     $url->setQuery("one=single");
     $this->assertSame("/path/to/file.php?one=single", $url->getRelative());
     $url->setFragment("top");
     $this->assertSame("/path/to/file.php?one=single#top", $url->getRelative());
     $url->setFauxDir("/faux/Dir");
     $this->assertSame("/path/to/file.php/faux/Dir?one=single#top", $url->getRelative());
     $url->clearQuery();
     $this->assertSame("/path/to/file.php/faux/Dir#top", $url->getRelative());
     $url->clearPath();
     $this->assertSame("#top", $url->getRelative());
     $url->setQuery("one=single");
     $this->assertSame("?one=single#top", $url->getRelative());
 }