Removed method runOcc from FeatureContext, and refactored code

This commit is contained in:
Prarup Gurung
2023-03-15 17:16:54 +05:45
parent 6f7bd454b2
commit aac714be9a
7 changed files with 2 additions and 368 deletions
@@ -3944,67 +3944,6 @@ class FeatureContext extends BehatVariablesContext {
}
}
/**
* Invokes an OCC command
*
* @param array|null $args of the occ command
* @param string|null $adminUsername
* @param string|null $adminPassword
* @param string|null $baseUrl
* @param string|null $ocPath
*
* @return int exit code
* @throws Exception if ocPath has not been set yet or the testing app is not enabled
*/
public function runOcc(
?array $args = [],
?string $adminUsername = null,
?string $adminPassword = null,
?string $baseUrl = null,
?string $ocPath = null
): int {
return $this->runOccWithEnvVariables(
$args,
null,
$adminUsername,
$adminPassword,
$baseUrl,
$ocPath
);
}
/**
* Invokes an OCC command with an optional array of environment variables
*
* @param array|null $args of the occ command
* @param array|null $envVariables to be defined before the command is run
* @param string|null $adminUsername
* @param string|null $adminPassword
* @param string|null $baseUrl
* @param string|null $ocPath
*
* @return int exit code
* @throws Exception if ocPath has not been set yet or the testing app is not enabled
*/
public function runOccWithEnvVariables(
?array $args = [],
?array $envVariables = null,
?string $adminUsername = null,
?string $adminPassword = null,
?string $baseUrl = null,
?string $ocPath = null
): int {
$args[] = '--no-ansi';
if ($baseUrl == null) {
$baseUrl = $this->getBaseUrl();
}
$return = ['code' => '', 'stdOut' => '', 'stdErr' => '' ];
$this->lastStdOut = $return['stdOut'];
$this->lastStdErr = $return['stdErr'];
$occStatusCode = (int)$return['code'];
return $occStatusCode;
}
/**
* Find exception texts in stderr
*