Skip to content

Commit

Permalink
MDL-80862 testing: Reset task manager between behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Feb 20, 2024
1 parent e4bbd79 commit 7653886
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/behat/classes/util.php
Expand Up @@ -432,6 +432,9 @@ public static function reset_all_data() {
// 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();
Expand Down
9 changes: 9 additions & 0 deletions lib/classes/task/manager.php
Expand Up @@ -64,6 +64,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.
*
Expand Down

0 comments on commit 7653886

Please sign in to comment.