public function testWithHost() { $uri = new Uri('http://*****:*****@local.example.com:8080/foo?bar=baz#quz'); $new = $uri->withHost('www.example.com'); $this->assertNotSame($uri, $new); $this->assertSame($new->getHost(), 'www.example.com'); $this->assertSame('http://*****:*****@www.example.com:8080/foo?bar=baz#quz', (string) $new); // $uri = new Uri('file:///C:/test.html'); $this->assertSame($uri->getHost(), 'localhost'); $new = $uri->withHost('192.168.0.100'); $this->assertNotSame($uri, $new); $this->assertSame($new->getHost(), '192.168.0.100'); $this->assertSame('file://192.168.0.100/C:/test.html', (string) $new); }