mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-68705 testing: New CLI args to disable composer features
This commit introduces the following new flags: --no-composer-self-update Disable composer self-update of the composer.phar utility --no-composer-upgrade Disable upgrade of development dependencies using Composer. --disable-composer Disable both composer self-update and composer upgrade
This commit is contained in:
parent
b430493ca8
commit
5e60d77da1
2 changed files with 88 additions and 12 deletions
|
@ -50,6 +50,9 @@ list($options, $unrecognized) = cli_get_params(
|
||||||
'optimize-runs' => '',
|
'optimize-runs' => '',
|
||||||
'add-core-features-to-theme' => false,
|
'add-core-features-to-theme' => false,
|
||||||
'axe' => false,
|
'axe' => false,
|
||||||
|
'disable-composer' => false,
|
||||||
|
'composer-upgrade' => true,
|
||||||
|
'composer-self-update' => true,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'j' => 'parallel',
|
'j' => 'parallel',
|
||||||
|
@ -65,17 +68,34 @@ $help = "
|
||||||
Behat utilities to initialise behat tests
|
Behat utilities to initialise behat tests
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
php init.php [--parallel=value [--maxruns=value] [--fromrun=value --torun=value]] [--help]
|
php init.php [--parallel=value [--maxruns=value] [--fromrun=value --torun=value]]
|
||||||
|
[--axe] [-o | --optimize-runs] [-a | --add-core-features-to-theme]
|
||||||
|
[--no-composer-self-update] [--no-composer-upgrade]
|
||||||
|
[--disable-composer]
|
||||||
|
[--help]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-j, --parallel Number of parallel behat run to initialise
|
-j, --parallel Number of parallel behat run to initialise
|
||||||
-m, --maxruns Max parallel processes to be executed at one time.
|
-m, --maxruns Max parallel processes to be executed at one time
|
||||||
--fromrun Execute run starting from (Used for parallel runs on different vms)
|
--fromrun Execute run starting from (Used for parallel runs on different vms)
|
||||||
--torun Execute run till (Used for parallel runs on different vms)
|
--torun Execute run till (Used for parallel runs on different vms)
|
||||||
--axe Include axe accessibility tests
|
--axe Include axe accessibility tests
|
||||||
|
|
||||||
-o, --optimize-runs Split features with specified tags in all parallel runs.
|
-o, --optimize-runs
|
||||||
-a, --add-core-features-to-theme Add all core features to specified theme's
|
Split features with specified tags in all parallel runs.
|
||||||
|
|
||||||
|
-a, --add-core-features-to-theme
|
||||||
|
Add all core features to specified theme's
|
||||||
|
|
||||||
|
--no-composer-self-update
|
||||||
|
Prevent upgrade of the composer utility using its self-update command
|
||||||
|
|
||||||
|
--no-composer-upgrade
|
||||||
|
Prevent update development dependencies using composer
|
||||||
|
|
||||||
|
--disable-composer
|
||||||
|
A shortcut to disable composer self-update and dependency update
|
||||||
|
Note: Installation of composer and/or dependencies will still happen as required
|
||||||
|
|
||||||
-h, --help Print out this help
|
-h, --help Print out this help
|
||||||
|
|
||||||
|
@ -120,8 +140,15 @@ if ($options['parallel'] && $options['parallel'] > 1) {
|
||||||
$cwd = getcwd();
|
$cwd = getcwd();
|
||||||
$output = null;
|
$output = null;
|
||||||
|
|
||||||
// If behat dependencies not downloaded then do it first, else symfony/process can't be used.
|
if ($options['disable-composer']) {
|
||||||
testing_update_composer_dependencies();
|
// Disable self-update and upgrade easily.
|
||||||
|
// Note: Installation will still occur regardless of this setting.
|
||||||
|
$options['composer-self-update'] = false;
|
||||||
|
$options['composer-upgrade'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Install and update composer and dependencies as required.
|
||||||
|
testing_update_composer_dependencies($options['composer-self-update'], $options['composer-upgrade']);
|
||||||
|
|
||||||
// Check whether the behat test environment needs to be updated.
|
// Check whether the behat test environment needs to be updated.
|
||||||
chdir(__DIR__);
|
chdir(__DIR__);
|
||||||
|
|
|
@ -38,8 +38,57 @@ require_once(__DIR__.'/../../../../lib/clilib.php');
|
||||||
require_once(__DIR__.'/../../../../lib/phpunit/bootstraplib.php');
|
require_once(__DIR__.'/../../../../lib/phpunit/bootstraplib.php');
|
||||||
require_once(__DIR__.'/../../../../lib/testing/lib.php');
|
require_once(__DIR__.'/../../../../lib/testing/lib.php');
|
||||||
|
|
||||||
|
list($options, $unrecognized) = cli_get_params(
|
||||||
|
[
|
||||||
|
'help' => false,
|
||||||
|
'disable-composer' => false,
|
||||||
|
'composer-upgrade' => true,
|
||||||
|
'composer-self-update' => true,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'h' => 'help',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$help = "
|
||||||
|
Utilities to initialise the PHPUnit test site.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
php init.php [--no-composer-self-update] [--no-composer-upgrade]
|
||||||
|
[--help]
|
||||||
|
|
||||||
|
--no-composer-self-update
|
||||||
|
Prevent upgrade of the composer utility using its self-update command
|
||||||
|
|
||||||
|
--no-composer-upgrade
|
||||||
|
Prevent update development dependencies using composer
|
||||||
|
|
||||||
|
--disable-composer
|
||||||
|
A shortcut to disable composer self-update and dependency update
|
||||||
|
Note: Installation of composer and/or dependencies will still happen as required
|
||||||
|
|
||||||
|
-h, --help Print out this help
|
||||||
|
|
||||||
|
Example from Moodle root directory:
|
||||||
|
\$ php admin/tool/phpunit/cli/init.php
|
||||||
|
";
|
||||||
|
|
||||||
|
if (!empty($options['help'])) {
|
||||||
|
echo $help;
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
echo "Initialising Moodle PHPUnit test environment...\n";
|
echo "Initialising Moodle PHPUnit test environment...\n";
|
||||||
testing_update_composer_dependencies();
|
|
||||||
|
if ($options['disable-composer']) {
|
||||||
|
// Disable self-update and upgrade easily.
|
||||||
|
// Note: Installation will still occur regardless of this setting.
|
||||||
|
$options['composer-self-update'] = false;
|
||||||
|
$options['composer-upgrade'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Install and update composer and dependencies as required.
|
||||||
|
testing_update_composer_dependencies($options['composer-self-update'], $options['composer-upgrade']);
|
||||||
|
|
||||||
$output = null;
|
$output = null;
|
||||||
exec('php --version', $output, $code);
|
exec('php --version', $output, $code);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue