mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-70917 tool_behat: fix profile/replace option comparison.
The `isset` call always returned true for the 'replace' option, because even if not specified it receives a non-null value. The `strpos` call now does a strict equality check rather than greater-than-or-equal (which always returns true).
This commit is contained in:
parent
d65ed58e73
commit
069cfef590
@ -45,7 +45,7 @@ list($options, $unrecognised) = cli_get_params(
|
|||||||
array(
|
array(
|
||||||
'stop-on-failure' => 0,
|
'stop-on-failure' => 0,
|
||||||
'verbose' => false,
|
'verbose' => false,
|
||||||
'replace' => false,
|
'replace' => '',
|
||||||
'help' => false,
|
'help' => false,
|
||||||
'tags' => '',
|
'tags' => '',
|
||||||
'profile' => '',
|
'profile' => '',
|
||||||
@ -70,7 +70,7 @@ $help = "
|
|||||||
Behat utilities to run behat tests in parallel
|
Behat utilities to run behat tests in parallel
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
php run.php [--BEHAT_OPTION=\"value\"] [--feature=\"value\"] [--replace] [--fromrun=value --torun=value] [--help]
|
php run.php [--BEHAT_OPTION=\"value\"] [--feature=\"value\"] [--replace=\"{run}\"] [--fromrun=value --torun=value] [--help]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--BEHAT_OPTION Any combination of behat option specified in http://behat.readthedocs.org/en/v2.5/guides/6.cli.html
|
--BEHAT_OPTION Any combination of behat option specified in http://behat.readthedocs.org/en/v2.5/guides/6.cli.html
|
||||||
@ -144,9 +144,10 @@ $extraopts = $unrecognised;
|
|||||||
if ($options['profile']) {
|
if ($options['profile']) {
|
||||||
$profile = $options['profile'];
|
$profile = $options['profile'];
|
||||||
|
|
||||||
// If profile passed is not set, then exit.
|
// If profile passed is not set, then exit (note we skip if the 'replace' option is found within the 'profile' value).
|
||||||
if (!isset($CFG->behat_config[$profile]) && !isset($CFG->behat_profiles[$profile]) &&
|
if (!isset($CFG->behat_config[$profile]) && !isset($CFG->behat_profiles[$profile]) &&
|
||||||
!(isset($options['replace']) && (strpos($options['profile'], $options['replace']) >= 0 ))) {
|
!($options['replace'] && (strpos($profile, (string) $options['replace']) !== false))) {
|
||||||
|
|
||||||
echo "Invalid profile passed: " . $profile . PHP_EOL;
|
echo "Invalid profile passed: " . $profile . PHP_EOL;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user