Exemplo n.º 1
0
 public function testGettersAndSetters()
 {
     $uri1 = new Uri('');
     $uri2 = $uri1->withScheme('HTTP')->withUserInfo('foo', 'bar')->withHost('EXAMPLE.com')->withPort(81)->withPath('/FOO/bar')->withQuery('a=2&b=3')->withFragment('foobar');
     $this->assertEquals('http', $uri2->getScheme());
     $this->assertEquals('foo:bar', $uri2->getUserInfo());
     $this->assertEquals('example.com', $uri2->getHost());
     $this->assertEquals(81, $uri2->getPort());
     $this->assertEquals('/foo/bar', $uri2->getPath());
     $this->assertEquals('a=2&b=3', $uri2->getQuery());
     $this->assertEquals('foobar', $uri2->getFragment());
 }
Exemplo n.º 2
0
 public function testWithScheme()
 {
     $uri = new Uri('http://www.yahoo.com');
     $this->assertEquals('https://www.yahoo.com', $uri->withScheme('https')->toString());
     $uri = new Uri('http://*****:*****@example.com:8042/over/there?name=ferret&foo=bar#nose');
     $this->assertEquals('https://*****:*****@example.com:8042/over/there?name=ferret&foo=bar#nose', $uri->withScheme('https')->toString());
 }