mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-78738 core_testing: Add helper to run adhoc tasks
This commit is contained in:
parent
a1d5d1b2f7
commit
235d5b9b72
@ -719,4 +719,16 @@ abstract class advanced_testcase extends base_testcase {
|
||||
}
|
||||
$tasks->close();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run adhoc tasks.
|
||||
*/
|
||||
protected function run_all_adhoc_tasks(): void {
|
||||
// Run the adhoc task.
|
||||
while ($task = \core\task\manager::get_next_adhoc_task(time())) {
|
||||
$task->execute();
|
||||
\core\task\manager::adhoc_task_complete($task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user