From 215a88762905e2f37bcdf1bc180995b26b4b5137 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Tue, 11 Jun 2024 13:23:40 +0200 Subject: [PATCH] MDL-82162 tool: Switch to admin when executing runtestscenario by CLI When the runtestscenario is executed via CLI, generators requiring a valid $USER will fail. This patch switches to the admin user, consistent with the approach used in other simlar CLI scripts. --- admin/tool/generator/cli/runtestscenario.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/tool/generator/cli/runtestscenario.php b/admin/tool/generator/cli/runtestscenario.php index efe47811c4f..855544a0a67 100644 --- a/admin/tool/generator/cli/runtestscenario.php +++ b/admin/tool/generator/cli/runtestscenario.php @@ -118,6 +118,9 @@ if (!file_exists($featurefile)) { exit(0); } +// Switch to admin user account. +\core\session\manager::set_user(get_admin()); + $runner = new tool_generator\local\testscenario\runner(); try {