feature #18184 [DomCrawler] Expose getter for uri (hason)
This PR was merged into the 3.1-dev branch.
Discussion
----------
[DomCrawler] Expose getter for uri
| Q | A
| ------------- | ---
| Branch |
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Same as #18143
Commits
-------
baebdb4
[DomCrawler] Exposed getter for uri
This commit is contained in:
commit
0469c4a380
@ -70,6 +70,16 @@ class Crawler implements \Countable, \IteratorAggregate
|
||||
$this->add($node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current URI.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUri()
|
||||
{
|
||||
return $this->uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
|
||||
public function testGetUri()
|
||||
{
|
||||
$uri = 'http://symfony.com';
|
||||
$crawler = new Crawler(null, $uri);
|
||||
$this->assertEquals($uri, $crawler->getUri());
|
||||
}
|
||||
|
||||
public function testGetBaseHref()
|
||||
{
|
||||
$baseHref = 'http://symfony.com';
|
||||
|
Reference in New Issue
Block a user