Skip to content

Commit

Permalink
Merge pull request #169 from Metadrop/feature/url-context
Browse files Browse the repository at this point in the history
Parse str expects string, null given
  • Loading branch information
rsanzante authored Nov 6, 2023
2 parents 695f1e4 + c6aa1d7 commit 4fdb69c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Behat/Context/UrlContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class UrlContext extends RawMinkContext {
*/
public function urlShouldHaveParamWithValue($param, $value, $have = TRUE) {
$url = $this->getSession()->getCurrentUrl();
$url_query = parse_url($url, PHP_URL_QUERY) ?? '';
$queries = [];
parse_str(parse_url($url, PHP_URL_QUERY), $queries);
parse_str($url_query, $queries);
if (!(isset($queries[$param]) && $queries[$param] == $value) && $have) {
throw new \Exception("The param " . $param . " with value " . $value . " is not in the url");
}
Expand Down

0 comments on commit 4fdb69c

Please sign in to comment.