[DomCrawler] trim URI in getURI

This commit is contained in:
stealth35 2011-11-10 15:38:28 +01:00
parent 3c584f5683
commit a245e15434
2 changed files with 5 additions and 1 deletions

View File

@ -77,7 +77,7 @@ class Link
*/
public function getUri()
{
$uri = $this->getRawUri();
$uri = trim($this->getRawUri());
// absolute URL?
if ('http' === substr($uri, 0, 4)) {

View File

@ -79,6 +79,10 @@ class LinkTest extends \PHPUnit_Framework_TestCase
return array(
array('/foo', 'http://localhost/bar/foo/', 'http://localhost/foo'),
array('/foo', 'http://localhost/bar/foo', 'http://localhost/foo'),
array('
/foo', 'http://localhost/bar/foo/', 'http://localhost/foo'),
array('/foo
', 'http://localhost/bar/foo', 'http://localhost/foo'),
array('foo', 'http://localhost/bar/foo/', 'http://localhost/bar/foo/foo'),
array('foo', 'http://localhost/bar/foo', 'http://localhost/bar/foo'),