Skip to content

Commit baebdb4

Browse files
committed
[DomCrawler] Exposed getter for uri
1 parent f29d46f commit baebdb4

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy