Exemple #1
0
 public function testImmutableMethods()
 {
     $url = new Url('http://example.com/about.htm');
     $this->assertSame('https://example.com/about.htm', (string) $url->scheme('https'));
     $this->assertSame('http://example.nl/about.htm', (string) $url->host('example.nl'));
     $this->assertSame('http://example.com:8080/about.htm', (string) $url->port(8080));
     $this->assertSame('http://example.com/disclaimer.htm', (string) $url->path('disclaimer.htm'));
     $this->assertSame('http://example.com/about.htm?param1=one', (string) $url->query(['param1' => 'one']));
     $this->assertSame('http://example.com/about.htm?param2=two', (string) $url->parameter('param2', 'two'));
     $this->assertSame('http://example.com/about.htm#author', (string) $url->fragment('author'));
     $this->assertEquals('http://example.com/about.htm', $url, 'Original url is unchanged');
 }