10000 feature #18184 [DomCrawler] Expose getter for uri (hason) · symfony/symfony@0469c4a · GitHub
[go: up one dir, main page]

Skip to content

Commit 0469c4a

Browse files
committed
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
2 parents f0b592b + baebdb4 commit 0469c4a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ public function __construct($node = null, $currentUri = null, $baseHref = null)
7070
$this->add($node);
7171
}
7272

73+
/**
74+
* Returns the current URI.
75+
*
76+
* @return string
77+
*/
78+
public function getUri()
79+
{
80+
return $this->uri;
81+
}
82+
7383
/**
7484
* Returns base href.
7585
*

src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ public function testConstructor()
2727
$this->assertCount(1, $crawler, '__construct() takes a node as a first argument');
2828
}
2929

30+
public function testGetUri()
31+
{
32+
$uri = 'http://symfony.com';
33+
$crawler = new Crawler(null, $uri);
34+
$this->assertEquals($uri, $crawler->getUri());
35+
}
36+
3037
public function testGetBaseHref()
3138
{
3239
$baseHref = 'http://symfony.com';

0 commit comments

Comments
 (0)
0