[DomCrawler] Exposed getter for uri
This commit is contained in:
parent
f29d46f29b
commit
baebdb4b69
@ -70,6 +70,16 @@ class Crawler implements \Countable, \IteratorAggregate
|
|||||||
$this->add($node);
|
$this->add($node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current URI.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUri()
|
||||||
|
{
|
||||||
|
return $this->uri;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns base href.
|
* Returns base href.
|
||||||
*
|
*
|
||||||
|
@ -27,6 +27,13 @@ class CrawlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertCount(1, $crawler, '__construct() takes a node as a first argument');
|
$this->assertCount(1, $crawler, '__construct() takes a node as a first argument');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetUri()
|
||||||
|
{
|
||||||
|
$uri = 'http://symfony.com';
|
||||||
|
$crawler = new Crawler(null, $uri);
|
||||||
|
$this->assertEquals($uri, $crawler->getUri());
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetBaseHref()
|
public function testGetBaseHref()
|
||||||
{
|
{
|
||||||
$baseHref = 'http://symfony.com';
|
$baseHref = 'http://symfony.com';
|
||||||
|
Reference in New Issue
Block a user