public function testString() { $value = 'http://*****:*****@host:8080/path?name=value#fragment'; $url = new Url($value); $this->assertEquals($value, (string) $url); $this->assertEquals($value, $url->toString()); $this->assertEquals('http', $url->scheme()); $this->assertEquals('user', $url->user()); $this->assertEquals('pass', $url->pass()); $this->assertEquals('host', $url->host()); $this->assertEquals('8080', $url->port()); $this->assertEquals('/path', $url->path()); $this->assertEquals('name=value', $url->query()); $this->assertEquals('fragment', $url->fragment()); $this->assertEquals('http://*****:*****@host:8080', $url->toPart(Url::PART_PORT)->toString()); $value = 'http://user@host/'; $url = new Url($value); $this->assertEquals($value, $url->toString()); $value = 'host/'; $url = new Url($value); $this->assertEquals($value, $url->toString()); $value = '?test=1'; $url = new Url($value); $this->assertEquals($value, $url->toString()); }