MDL-39552 Make behat code re-entrant safe

With yui combo in action, some times setup.php is
included more than once. So it's mandatory to
guarantee that code until ABORT_AFTER_CONFIG_CANCEL
can be executed safely multiple times in the same
request.

This change just prevents the behat section to be executed
more than once. All the values that are set within it
should be already defined for the re-entrant call.
This commit is contained in:
Eloy Lafuente (stronk7) 2013-05-07 18:48:24 +02:00
parent 5b003e9cdd
commit de10fcac5f

View File

@ -107,7 +107,8 @@ if (!empty($CFG->behat_switchcompletely)) {
// Test environment is enabled if:
// * User has previously enabled through admin/tool/behat/cli/util.php --enable.
// Both are required to switch to test mode
if (!empty($CFG->behat_dataroot) && !empty($CFG->behat_prefix) && file_exists($CFG->behat_dataroot)) {
if (!defined('BEHAT_SITE_RUNNING') && !empty($CFG->behat_dataroot) &&
!empty($CFG->behat_prefix) && file_exists($CFG->behat_dataroot)) {
$CFG->behat_dataroot = realpath($CFG->behat_dataroot);