From a910e3885afa73fc0e43b4d8fa8765b55480ebbc Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 14 Apr 2015 11:31:50 +0800 Subject: [PATCH] MDL-49840 testing: Ensure that composer dependencies are updated We should ensure that composer dependencies are present before running phpunit and behat. We should also ensure that they match the versions in the composer.lock file. Doing so ensures that we have a consistency across the board amongst testers. All testers are a specific commit will be using the same version of composer.lock and the same version of the relevant tools. --- admin/tool/behat/cli/init.php | 16 ++-------------- admin/tool/phpunit/cli/init.php | 3 +++ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/admin/tool/behat/cli/init.php b/admin/tool/behat/cli/init.php index d4300d989bb..c24eaeacd55 100644 --- a/admin/tool/behat/cli/init.php +++ b/admin/tool/behat/cli/init.php @@ -96,25 +96,13 @@ if ($options['parallel']) { $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")) { - $installcomposer = false; - testing_update_composer_dependencies(); -} +testing_update_composer_dependencies(); +// Check whether the behat test environment needs to be updated. chdir(__DIR__); exec("php $utilfile --diag $paralleloption", $output, $code); -// Check if composer needs to be updated. -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) { echo "Behat test environment already installed\n"; diff --git a/admin/tool/phpunit/cli/init.php b/admin/tool/phpunit/cli/init.php index eb807ee4d14..078527784d0 100644 --- a/admin/tool/phpunit/cli/init.php +++ b/admin/tool/phpunit/cli/init.php @@ -39,6 +39,7 @@ require_once(__DIR__.'/../../../../lib/phpunit/bootstraplib.php'); require_once(__DIR__.'/../../../../lib/testing/lib.php'); echo "Initialising Moodle PHPUnit test environment...\n"; +testing_update_composer_dependencies(); $output = null; exec('php --version', $output, $code); @@ -72,4 +73,6 @@ if ($code == 0) { passthru("php util.php --buildconfig", $code); +echo "\n"; +echo "PHPUnit test environment setup complete.\n"; exit(0);