MOBILE-4061 behat: Fix custom url with path on root

main
Pau Ferrer Ocaña 2022-05-30 13:41:26 +02:00
parent d75e876cad
commit 2bb3ff81e1
1 changed files with 3 additions and 3 deletions

View File

@ -512,9 +512,9 @@ class behat_app_helper extends behat_base {
// Generate custom URL.
$parsed_url = parse_url($CFG->behat_wwwroot);
$domain = $parsed_url['host'];
$rootpath = $parsed_url['path'];
$url = $this->get_mobile_url_scheme() . "://$username@$domain/$rootpath?token=$token&privatetoken=$privatetoken";
$domain = $parsed_url['host'] ?? '';
$rootpath = $parsed_url['path'] ?? '';
$url = $this->get_mobile_url_scheme() . "://$username@$domain$rootpath?token=$token&privatetoken=$privatetoken";
if (!empty($path)) {
$url .= '&redirect='.urlencode($CFG->behat_wwwroot.$path);