Browse files

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

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.
  • Loading branch information...
1 parent 5b003e9 commit de10fcac5f8fd6b5f1c047842faaa81bd04e0b81 @stronk7 stronk7 committed May 7, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/setup.php
@@ -107,7 +107,8 @@
// 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);

0 comments on commit de10fca

Please sign in to comment.