Skip to content

Commit

Permalink
MDL-49374 behat: Get install or re-install error code after composer
Browse files Browse the repository at this point in the history
After composer is installed make sure we just process only
install or re-install
  • Loading branch information
Rajesh Taneja committed Mar 20, 2015
1 parent a149d6a commit c87881b
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions admin/tool/behat/cli/init.php
Expand Up @@ -96,17 +96,23 @@
$cwd = getcwd();
$output = null;

$installcomposer = true;
// If behat dependencies not downloaded then do it first, else symfony/process can't be used.
if ($options['parallel'] && !file_exists(__DIR__ . "/../../../../vendor/autoload.php")) {
$code = BEHAT_EXITCODE_COMPOSER;
} else {
chdir(__DIR__);
exec("php $utilfile --diag $paralleloption", $output, $code);
$installcomposer = false;
testing_update_composer_dependencies();
}

chdir(__DIR__);
exec("php $utilfile --diag $paralleloption", $output, $code);

// Check if composer needs to be updated.
if (($code == BEHAT_EXITCODE_INSTALL) || $code == BEHAT_EXITCODE_REINSTALL || $code == BEHAT_EXITCODE_COMPOSER) {
if ($installcomposer &&
($code == BEHAT_EXITCODE_INSTALL || $code == BEHAT_EXITCODE_REINSTALL || $code == BEHAT_EXITCODE_COMPOSER)) {
testing_update_composer_dependencies();
// Check again for behat test site and see if it's install or re-install.
chdir(__DIR__);
exec("php $utilfile --diag $paralleloption", $output, $code);
}

if ($code == 0) {
Expand Down Expand Up @@ -137,16 +143,6 @@
exit($code);
}

} else if ($code == BEHAT_EXITCODE_COMPOSER) {
// Missing Behat dependencies.
// Returning to admin/tool/behat/cli.
chdir(__DIR__);
passthru("php $utilfile --install $paralleloption", $code);
if ($code != 0) {
chdir($cwd);
exit($code);
}

} else {
// Generic error, we just output it.
echo implode("\n", $output)."\n";
Expand Down

0 comments on commit c87881b

Please sign in to comment.