Skip to content

Commit

Permalink
[DomCrawler] Exposed getter for baseHref
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ast authored and fabpot committed Mar 15, 2016
1 parent eb2a4f5 commit 53935df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Symfony/Component/DomCrawler/Crawler.php
Expand Up @@ -72,6 +72,16 @@ public function __construct($node = null, $currentUri = null, $baseHref = null)
$this->add($node);
}

/**
* Returns base href.
*
* @return string
*/
public function getBaseHref()
{
return $this->baseHref;
}

/**
* Removes all the nodes.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
Expand Up @@ -27,6 +27,13 @@ public function testConstructor()
$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();
Expand Down

0 comments on commit 53935df

Please sign in to comment.