diff --git a/cache/classes/factory.php b/cache/classes/factory.php index fd78222497197..d6d1637b34182 100644 --- a/cache/classes/factory.php +++ b/cache/classes/factory.php @@ -126,7 +126,7 @@ public static function instance($forcereload = false) { // situation. It will use disabled alternatives where available. require_once($CFG->dirroot.'/cache/disabledlib.php'); self::$instance = new cache_factory_disabled(); - } else if ((defined('PHPUNIT_TEST') && PHPUNIT_TEST) || behat_is_test_site()) { + } else if ((defined('PHPUNIT_TEST') && PHPUNIT_TEST) || defined('BEHAT_SITE_RUNNING')) { // We're using the test factory. require_once($CFG->dirroot.'/cache/tests/fixtures/lib.php'); self::$instance = new cache_phpunit_factory(); @@ -336,7 +336,7 @@ public function create_config_instance($writer = false) { // The class to use. $class = 'cache_config'; // Are we running tests of some form? - $testing = (defined('PHPUNIT_TEST') && PHPUNIT_TEST) || behat_is_test_site(); + $testing = (defined('PHPUNIT_TEST') && PHPUNIT_TEST) || defined('BEHAT_SITE_RUNNING'); // Check if this is a PHPUnit test and redirect to the phpunit config classes if it is. if ($testing) { diff --git a/lib/behat/lib.php b/lib/behat/lib.php index 4cb883f19b47a..86718a92a8ab9 100644 --- a/lib/behat/lib.php +++ b/lib/behat/lib.php @@ -17,7 +17,13 @@ /** * Behat basic functions * - * It does not include MOODLE_INTERNAL because is part of the bootstrap + * It does not include MOODLE_INTERNAL because is part of the bootstrap. + * + * This script should not be usually included, neither any of its functions + * used, within mooodle code at all. It's for exclusive use of behat and + * moodle setup.php. For places requiring a different/special behavior + * needing to check if are being run as part of behat tests, use: + * if (defined('BEHAT_SITE_RUNNING')) { ... * * @package core * @category test