Fixed issue where behat_update_vars_for_process changes $CFG prematurely.

This commit is contained in:
Daniel Thee Roperto
2018-06-12 16:34:50 +10:00
parent fc49fc0fcb
commit 490029cb65

View File

@@ -40,10 +40,13 @@ if (!isset($CFG->dataroot)) {
// 1) Make sure we replace the configurations for behat as we have not ran 'lib/setup.php' yet.
if (!empty($CFG->behat_wwwroot) or !empty($CFG->behat_dataroot) or !empty($CFG->behat_prefix)) {
require_once(__DIR__.'/../../lib/behat/lib.php');
// The function call below will change $CFG so let's save it and restore later if access is granted.
$beforebehatcfg = $CFG;
$CFG = clone($CFG);
behat_update_vars_for_process();
if (behat_is_test_site()) {
$beforebehatcfg = $CFG;
$CFG = clone($CFG);
clearstatcache();
behat_check_config_vars();
behat_clean_init_config();
@@ -82,4 +85,5 @@ $CFG->auth_outage_bootstrap_loaded = true;
// 5) Restore behat config as needed (let setup.php execute which is more complex than our quick-check).
if (isset($beforebehatcfg)) {
$CFG = $beforebehatcfg;
unset($beforebehatcfg);
}