Commit a7a6a1ba authored by freek's avatar freek

add extra test

parent fadbced3
......@@ -306,7 +306,7 @@ class Url implements UriInterface
$url .= $this->getAuthority();
}
$url .= $this->getPath();
$url .= rtrim($this->getPath(), '/');
if ($this->getQuery() !== '') {
$url .= '?'.$this->getQuery();
......@@ -316,7 +316,7 @@ class Url implements UriInterface
$url .= '#'.$this->getFragment();
}
return rtrim($url, '/');
return $url;
}
public function __clone()
......
......@@ -150,4 +150,15 @@ class UrlBuildTest extends \PHPUnit_Framework_TestCase
$url->__toString()
);
}
/** @test */
public function it_prefixes_the_path_if_the_url_has_an_authority_but_is_rootless()
{
$url = Url::create()
->withUserInfo('sebastian', 'supersecret')
->withPort(9000)
->withPath('opensource');
$this->assertEquals('//sebastian:supersecret@:9000/opensource', $url->__toString());
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment