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