MDL-77837 phpunit: Ensure that the cron user setter is used

When running an adhoc task in a unit test we should use the cron variant
of the set user method to mimic the behaviour of a real cron run.
This commit is contained in:
Andrew Nicols
2023-04-06 23:19:01 +08:00
parent 12b0f796b9
commit 5319ba9c15
3 changed files with 90 additions and 1 deletions
+1 -1
View File
@@ -696,7 +696,7 @@ abstract class advanced_testcase extends base_testcase {
}
\core\cron::prepare_core_renderer();
$this->setUser($user);
\core\cron::setup_user($user);
$task->execute();
\core\task\manager::adhoc_task_complete($task);