Skip to content

Commit

Permalink
MDL-55072 behat: Cache themesuite and theme contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajesh Taneja committed Aug 25, 2016
1 parent 14f3abe commit 6c1cc55
Showing 1 changed file with 9 additions and 3 deletions.
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 6c1cc55

Please sign in to comment.