From b9b474182a7a7106430e3b635c817b433cc1c4f0 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Wed, 5 Oct 2016 09:39:26 +0800 Subject: [PATCH] MDL-55986 behat: all options are not valid for single run Sanitize options which are valid for single run only --- admin/tool/behat/cli/init.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/admin/tool/behat/cli/init.php b/admin/tool/behat/cli/init.php index 37e1dc24240aa..fd728ef8336a3 100644 --- a/admin/tool/behat/cli/init.php +++ b/admin/tool/behat/cli/init.php @@ -91,12 +91,20 @@ // If parallel run then use utilparallel. if ($options['parallel'] && $options['parallel'] > 1) { $utilfile = 'util.php'; -} + // Sanitize all input options, so they can be passed to util. + foreach ($options as $option => $value) { + if ($value) { + $commandoptions .= " --$option='$value'"; + } + } +} else { + // Only sanitize options for single run. + $cmdoptionsforsinglerun = array('run-with-theme'); -// Sanitize input options, so they can be passed to util. -foreach ($options as $option => $value) { - if ($value) { - $commandoptions .= " --$option='$value'"; + foreach ($cmdoptionsforsinglerun as $option) { + if (!empty($options[$option])) { + $commandoptions .= " --$option='$options[$option]'"; + } } }