mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-32149 reset all globals in PHPUnit tests, fix setting of $USER
This commit is contained in:
parent
a3d5830a0a
commit
458b33866d
3 changed files with 103 additions and 21 deletions
|
@ -1070,6 +1070,13 @@ function session_set_user($user) {
|
|||
$_SESSION['USER'] = $user;
|
||||
unset($_SESSION['USER']->description); // conserve memory
|
||||
sesskey(); // init session key
|
||||
|
||||
if (PHPUNIT_TEST) {
|
||||
// phpunit tests use reversed reference
|
||||
global $USER;
|
||||
$USER = $_SESSION['USER'];
|
||||
$_SESSION['USER'] =& $USER;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue