Skip to content

Commit

Permalink
Merge branch 'wip-mdl-55072-fix' of git://github.com/rajeshtaneja/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Aug 25, 2016
2 parents cb5949e + 6c1cc55 commit 195288f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 36 deletions.
18 changes: 8 additions & 10 deletions admin/tool/behat/cli/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@
'help' => false,
'fromrun' => 1,
'torun' => 0,
'themesuitewithallfeatures' => false,
'run-with-theme' => false,
),
array(
'j' => 'parallel',
'm' => 'maxruns',
'h' => 'help',
'a' => 'themesuitewithallfeatures',
)
);

Expand All @@ -65,13 +64,12 @@
php init.php [--parallel=value [--maxruns=value] [--fromrun=value --torun=value]] [--help]
Options:
-j, --parallel Number of parallel behat run to initialise
-m, --maxruns Max parallel processes to be executed at one time.
--fromrun Execute run starting from (Used for parallel runs on different vms)
--torun Execute run till (Used for parallel runs on different vms)
-j, --parallel Number of parallel behat run to initialise
-m, --maxruns Max parallel processes to be executed at one time.
--fromrun Execute run starting from (Used for parallel runs on different vms)
--torun Execute run till (Used for parallel runs on different vms)
--run-with-theme Run all core features with specified theme.
-a, --themesuitewithallfeatures Theme suite do not include core features by default. If you want to run core features
with theme, then use this option.
-h, --help Print out this help
Example from Moodle root directory:
Expand Down Expand Up @@ -100,8 +98,8 @@
}

$themesuitewithallfeatures = '';
if ($options['themesuitewithallfeatures']) {
$themesuitewithallfeatures = '--themesuitewithallfeatures="true"';
if ($options['run-with-theme']) {
$themesuitewithallfeatures = '--run-with-theme="true"';
}

// Changing the cwd to admin/tool/behat/cli.
Expand Down
8 changes: 3 additions & 5 deletions admin/tool/behat/cli/run.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@
'fromrun' => 1,
'torun' => 0,
'single-run' => false,
'themesuitewithallfeatures' => false,
'run-with-theme' => false,
),
array(
'h' => 'help',
't' => 'tags',
'p' => 'profile',
's' => 'single-run',
'a' => 'themesuitewithallfeatures',
)
);

Expand All @@ -80,9 +79,8 @@
--replace Replace args string with run process number, useful for output.
--fromrun Execute run starting from (Used for parallel runs on different vms)
--torun Execute run till (Used for parallel runs on different vms)
--run-with-theme Run all core features with specified theme.
-a, --themesuitewithallfeatures Theme suite do not include core features by default. If you want to run core features
with theme, then use this option.
-h, --help Print out this help
Example from Moodle root directory:
Expand Down Expand Up @@ -196,7 +194,7 @@
} else {
$CFG->behat_dataroot = $behatdataroot . $i;
}
behat_config_manager::update_config_file('', true, $tags, $options['themesuitewithallfeatures'], $parallelrun);
behat_config_manager::update_config_file('', true, $tags, $options['run-with-theme'], $parallelrun);
}
$CFG->behat_dataroot = $behatdataroot;
$CFG->behat_wwwroot = $behatwwwroot;
Expand Down
11 changes: 5 additions & 6 deletions admin/tool/behat/cli/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@
'updatesteps' => false,
'fromrun' => 1,
'torun' => 0,
'themesuitewithallfeatures' => false,
'run-with-theme' => false,
),
array(
'h' => 'help',
'j' => 'parallel',
'm' => 'maxruns',
'a' => 'themesuitewithallfeatures',
)
);

Expand All @@ -83,8 +82,8 @@
-j, --parallel Number of parallel behat run operation
-m, --maxruns Max parallel processes to be executed at one time.
-a, --themesuitewithallfeatures Theme suite do not include core features by default. If you want to run core features
with theme, then use this option.
--run-with-theme Run all core features with specified theme.
-h, --help Print out this help
Example from Moodle root directory:
Expand Down Expand Up @@ -179,14 +178,14 @@
} else if ($options['updatesteps']) {
// Rewrite config file to ensure we have all the features covered.
if (empty($options['parallel'])) {
behat_config_manager::update_config_file('', true, '', $options['themesuitewithallfeatures'], false, false);
behat_config_manager::update_config_file('', true, '', $options['run-with-theme'], false, false);
} else {
// Update config file, ensuring we have up-to-date behat.yml.
for ($i = $options['fromrun']; $i <= $options['torun']; $i++) {
$CFG->behatrunprocess = $i;

// Update config file for each run.
behat_config_manager::update_config_file('', true, '', $options['themesuitewithallfeatures'],
behat_config_manager::update_config_file('', true, '', $options['run-with-theme'],
$options['parallel'], $i);
}
unset($CFG->behatrunprocess);
Expand Down
22 changes: 10 additions & 12 deletions admin/tool/behat/cli/util_single_run.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@
'diag' => false,
'tags' => '',
'updatesteps' => false,
'themesuitewithallfeatures' => false,
'run-with-theme' => false,
),
array(
'h' => 'help',
'a' => 'themesuitewithallfeatures',
)
);

Expand All @@ -67,15 +66,14 @@
php util_single_run.php [--install|--drop|--enable|--disable|--diag|--updatesteps|--help]
Options:
--install Installs the test environment for acceptance tests
--drop Drops the database tables and the dataroot contents
--enable Enables test environment and updates tests list
--disable Disables test environment
--diag Get behat test environment status code
--updatesteps Update feature step file.
-a, --themesuitewithallfeatures Theme suite do not include core features by default. If you want to run core features
with theme, then use this option.
--install Installs the test environment for acceptance tests
--drop Drops the database tables and the dataroot contents
--enable Enables test environment and updates tests list
--disable Disables test environment
--diag Get behat test environment status code
--updatesteps Update feature step file.
--run-with-theme Run all core features with specified theme.
-h, --help Print out this help
Example from Moodle root directory:
Expand Down Expand Up @@ -180,7 +178,7 @@
}

// Enable test mode.
behat_util::start_test_mode($options['themesuitewithallfeatures'], $parallel, $run);
behat_util::start_test_mode($options['run-with-theme'], $parallel, $run);

// This is only displayed once for parallel install.
if (empty($run)) {
Expand Down
12 changes: 9 additions & 3 deletions lib/behat/classes/behat_config_util.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ class behat_config_util {
*/
private $themecontexts;

/**
* @var array list of all contexts in theme suite.
*/
private $themesuitecontexts;

/**
* @var array list of overridden theme contexts.
*/
Expand Down Expand Up @@ -1202,8 +1207,8 @@ protected function get_overridden_theme_contexts() {
protected function get_behat_contexts_for_theme($theme) {

// If we already have this list then just return. This will not change by run.
if (!empty($this->themecontexts[$theme])) {
return $this->themecontexts[$theme];
if (!empty($this->themecontexts[$theme]) && !empty($this->themesuitecontexts)) {
return array(array_keys($this->themecontexts[$theme]), $this->themesuitecontexts[$theme]);
}

if (empty($this->overriddenthemescontexts)) {
Expand Down Expand Up @@ -1251,7 +1256,8 @@ protected function get_behat_contexts_for_theme($theme) {
}

// We are only interested in the class name of context.
$this->themecontexts[$theme] = $themesuitecontexts;
$this->themesuitecontexts[$theme] = $themesuitecontexts;
$this->themecontexts[$theme] = $themecontexts;

return array(array_keys($themecontexts), $themesuitecontexts);
}
Expand Down

0 comments on commit 195288f

Please sign in to comment.