24 self::validateConfigBasedVars(
$config);
30 if (in_array(
'selenium',
$params)) {
42 private static function sanitizeSeleniumEnvs(
$config)
44 if (
$config[
'protocol'] ==
'%SELENIUM_PROTOCOL%') {
47 if (
$config[
'host'] ==
'%SELENIUM_HOST%') {
50 if (
$config[
'port'] ==
'%SELENIUM_PORT%') {
53 if (
$config[
'path'] ==
'%SELENIUM_PATH%') {
66 private static function validateConfigBasedVars(
$config)
72 foreach ($configStrings as $configKey => $configValue) {
73 $var = trim((String)$configValue,
'%');
74 if (array_key_exists($var, $_ENV)) {
76 "Issue with setting configuration for test runs. Please make sure '{$var}' is " 77 .
"not duplicated as a system level variable",
92 trigger_error(
"MAGENTO_BASE_URL must be defined in .env", E_USER_ERROR);
95 if (filter_var(
$url, FILTER_VALIDATE_URL) ===
true) {
96 return rtrim(
$url,
"/") .
"/";
99 $urlParts = parse_url(
$url);
101 if (!isset($urlParts[
'scheme'])) {
102 $urlParts[
'scheme'] =
"http";
104 if (!isset($urlParts[
'host'])) {
105 $urlParts[
'host'] = rtrim($urlParts[
'path'],
"/");
106 $urlParts[
'host'] = str_replace(
"//",
"/", $urlParts[
'host']);
107 unset($urlParts[
'path']);
110 if (!isset($urlParts[
'path'])) {
111 $urlParts[
'path'] =
"/";
113 $urlParts[
'path'] = rtrim($urlParts[
'path'],
"/") .
"/";
116 return str_replace(
"///",
"//", self::buildUrl($urlParts));
125 private static function buildUrl(array $parts)
127 $get =
function ($key) use ($parts) {
128 return isset($parts[$key]) ? $parts[$key] :
null;
131 $pass = $get(
'pass');
132 $user = $get(
'user');
133 $userinfo = $pass !==
null ?
"$user:$pass" :
$user;
134 $port = $get(
'port');
135 $scheme = $get(
'scheme');
137 $fragment = $get(
'fragment');
139 ($userinfo !==
null ?
"$userinfo@" :
'') .
141 ($port ?
":$port" :
'');
144 (strlen($scheme) ?
"$scheme:" :
'') .
145 (strlen($authority) ?
"//$authority" :
'') .
147 (strlen(
$query) ?
"?$query" :
'') .
148 (strlen($fragment) ?
"#$fragment" :
'');
static sanitizeWebDriverConfig($config, $params=['url', 'selenium'])
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]