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:21:29 +08:00
parent be8fac6291
commit 46ea3269fc
3 changed files with 90 additions and 1 deletions
+1 -1
View File
@@ -733,7 +733,7 @@ abstract class advanced_testcase extends base_testcase {
}
cron_prepare_core_renderer();
$this->setUser($user);
cron_setup_user($user);
$task->execute();
\core\task\manager::adhoc_task_complete($task);