public function testChangePath()
 {
     $url = new \webignition\Url\Url('http://example.com/path');
     $url->setPath('/new-path');
     $this->assertEquals('/new-path', $url->getPath());
     $this->assertEquals('http://example.com/new-path', (string) $url);
 }
Beispiel #2
0
 public function testSetPathWhenExistingPathIsUrlEncoded()
 {
     $url = new \webignition\Url\Url('js/scriptaculous.js?load=effects,builder');
     $this->assertEquals('js/scriptaculous.js?load=effects%2Cbuilder', (string) $url);
     $url->setPath('/js/scriptaculous.js');
     $this->assertEquals('/js/scriptaculous.js?load=effects%2Cbuilder', (string) $url);
 }
 public function testAddPathToRootUrl()
 {
     $url = new \webignition\Url\Url('http://example.com');
     $url->setPath('/index.html');
     $this->assertEquals('http://example.com/index.html', (string) $url);
     $url = new \webignition\Url\Url('http://example.com/');
     $url->setPath('/index.html');
     $this->assertEquals('http://example.com/index.html', (string) $url);
 }
Beispiel #4
0
 public function testSetPathThenHostThenSchemeThenUser()
 {
     $url = new \webignition\Url\Url('example.php');
     $this->assertEquals('example.php', (string) $url);
     $url->setPath('/pathOne/Path2/path2/example2.php');
     $this->assertEquals('/pathOne/Path2/path2/example2.php', (string) $url);
     $url->setHost('www.example.com');
     $this->assertEquals('//www.example.com/pathOne/Path2/path2/example2.php', (string) $url);
     $url->setScheme('http');
     $this->assertEquals('http://www.example.com/pathOne/Path2/path2/example2.php', (string) $url);
     $url->setUser('user');
     $this->assertEquals('http://user:@www.example.com/pathOne/Path2/path2/example2.php', (string) $url);
 }
Beispiel #5
0
 public function testReplaceFragmentPassPathPortQueryUserWithNull()
 {
     $url = new \webignition\Url\Url('http://*****:*****@example.com:443/path/here?param=value#fragment');
     $url->setFragment(null);
     $url->setPass(null);
     $url->setPath(null);
     $url->setPort(null);
     $url->setQuery(null);
     $url->setUser(null);
     $this->assertNull($url->getFragment());
     $this->assertNull($url->getPass());
     $this->assertNull($url->getPath());
     $this->assertNull($url->getPort());
     $this->assertNull($url->getQuery());
     $this->assertNull($url->getUser());
     $this->assertEquals("http://example.com", (string) $url);
 }
 public function testAddPathToHashAndIdentifier()
 {
     $url = new \webignition\Url\Url('#foo');
     $url->setPath('/index.html');
     $this->assertEquals('/index.html#foo', (string) $url);
 }