MDL-55072 behat: Cache themesuite and theme contexts

This commit is contained in:
Rajesh Taneja 2016-08-25 09:17:38 +08:00
parent 14f3abee2e
commit 6c1cc55d92
No known key found for this signature in database
GPG key ID: B363F7FB787F80E4

View file

@ -55,6 +55,11 @@ class behat_config_util {
*/ */
private $themecontexts; private $themecontexts;
/**
* @var array list of all contexts in theme suite.
*/
private $themesuitecontexts;
/** /**
* @var array list of overridden theme contexts. * @var array list of overridden theme contexts.
*/ */
@ -1202,8 +1207,8 @@ class behat_config_util {
protected function get_behat_contexts_for_theme($theme) { protected function get_behat_contexts_for_theme($theme) {
// If we already have this list then just return. This will not change by run. // If we already have this list then just return. This will not change by run.
if (!empty($this->themecontexts[$theme])) { if (!empty($this->themecontexts[$theme]) && !empty($this->themesuitecontexts)) {
return $this->themecontexts[$theme]; return array(array_keys($this->themecontexts[$theme]), $this->themesuitecontexts[$theme]);
} }
if (empty($this->overriddenthemescontexts)) { if (empty($this->overriddenthemescontexts)) {
@ -1251,7 +1256,8 @@ class behat_config_util {
} }
// We are only interested in the class name of context. // 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); return array(array_keys($themecontexts), $themesuitecontexts);
} }