mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-45699 behat: Don't use behat/lib.php functions in core.
behat/lib.php 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')) { ...
This commit is contained in:
parent
cb878d027b
commit
c0d8831ae7
4
cache/classes/factory.php
vendored
4
cache/classes/factory.php
vendored
@ -126,7 +126,7 @@ class cache_factory {
|
||||
// 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 @@ class cache_factory {
|
||||
// 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) {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user