mirror of
https://github.com/moodle/moodle.git
synced 2025-04-23 09:23:09 +02:00
MDL-35238 Add support for explicit singleton reset
This may be needed during PHPUnit testing.
This commit is contained in:
parent
80e9ba96c7
commit
dc11af1903
lib
@ -655,6 +655,9 @@ class phpunit_util {
|
||||
if (class_exists('available_update_checker')) {
|
||||
available_update_checker::reset_caches(true);
|
||||
}
|
||||
if (class_exists('available_update_deployer')) {
|
||||
available_update_deployer::reset_caches(true);
|
||||
}
|
||||
|
||||
// purge dataroot directory
|
||||
self::reset_dataroot();
|
||||
|
@ -1469,6 +1469,17 @@ class available_update_deployer {
|
||||
return self::$singletoninstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset caches used by this script
|
||||
*
|
||||
* @param bool $phpunitreset is this called as a part of PHPUnit reset?
|
||||
*/
|
||||
public static function reset_caches($phpunitreset = false) {
|
||||
if ($phpunitreset) {
|
||||
self::$singletoninstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is automatic deployment enabled?
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user