From b74d388388817492c027f45ce6032844b19cd8f8 Mon Sep 17 00:00:00 2001 From: Mathieu Santostefano Date: Mon, 14 May 2018 16:43:11 +0200 Subject: [PATCH 1/2] Trim final # in URIs --- src/SmokerTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SmokerTestCase.php b/src/SmokerTestCase.php index 1010af6..ac262f9 100644 --- a/src/SmokerTestCase.php +++ b/src/SmokerTestCase.php @@ -50,7 +50,7 @@ public function smokeTest($data) $links = $crawler->filterXPath('//a')->links(); foreach ($links as $link) { - $uri = $link->getUri(); + $uri = rtrim($link->getUri(), '#'); if ($this->hasReachedDiscoveryLimit($discovery)) { return; From ae1fd59ecded6788a633e1069d6aff4ed08c4af8 Mon Sep 17 00:00:00 2001 From: Mathieu Santostefano Date: Mon, 14 May 2018 18:14:54 +0200 Subject: [PATCH 2/2] Remove all data after # in uri --- src/SmokerTestCase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SmokerTestCase.php b/src/SmokerTestCase.php index ac262f9..34b70ec 100644 --- a/src/SmokerTestCase.php +++ b/src/SmokerTestCase.php @@ -50,7 +50,9 @@ public function smokeTest($data) $links = $crawler->filterXPath('//a')->links(); foreach ($links as $link) { - $uri = rtrim($link->getUri(), '#'); + $uri = $link->getUri(); + $fragment = parse_url($uri, PHP_URL_FRAGMENT); + $uri = str_replace('#' . $fragment, '', $uri); if ($this->hasReachedDiscoveryLimit($discovery)) { return;