MDL-80862 testing: Reset task manager between behat tests

This commit is contained in:
Andrew Nicols 2024-02-20 10:54:12 +08:00
parent 4d217e3a1a
commit 6dbd0e938f
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
2 changed files with 12 additions and 0 deletions

View File

@ -432,6 +432,9 @@ class behat_util extends testing_util {
// Inform data generator.
self::get_data_generator()->reset();
// Reset the task manager.
\core\task\manager::reset_state();
// Initialise $CFG with default values. This is needed for behat cli process, so we don't have modified
// $CFG values from the old run. @see set_config.
self::remove_added_config();

View File

@ -61,6 +61,15 @@ class manager {
*/
public static $mode;
/**
* Reset the state of the task manager.
*/
public static function reset_state(): void {
self::$miniqueue = null;
self::$numtasks = null;
self::$mode = null;
}
/**
* Given a component name, will load the list of tasks in the db/tasks.php file for that component.
*