Exemplo n.º 1
0
 public function testSetSchemeOnProtocolRelativeUrl()
 {
     $url = new \webignition\Url\Url('//example.com');
     $url->setScheme('http');
     $this->assertEquals('http', $url->getScheme());
     $this->assertEquals('http://example.com', (string) $url);
 }
Exemplo n.º 2
0
 public function testChangeScheme()
 {
     $url = new \webignition\Url\Url('http://example.com/');
     $url->setScheme('https');
     $this->assertEquals('https', $url->getScheme());
     $this->assertEquals('https://example.com/', (string) $url);
 }
Exemplo n.º 3
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);
 }
 public function testNullifySchemeMakesUrlProtocolRelative()
 {
     $url = new \webignition\Url\Url('http://example.com/foo/bar/index.html');
     $url->setScheme(null);
     $this->assertEquals('//example.com/foo/bar/index.html', (string) $url);
 }