Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0469c4a

Browse filesBrowse 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
Copy full SHA for 0469c4a

File tree

2 files changed

+17
-0
lines changed
Filter options

2 files changed

+17
-0
lines changed

‎src/Symfony/Component/DomCrawler/Crawler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Crawler.php
+10Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
+7Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.