MDL-32149 reset all globals in PHPUnit tests, fix setting of $USER

This commit is contained in:
Petr Skoda 2012-04-02 17:56:27 +02:00
parent a3d5830a0a
commit 458b33866d
3 changed files with 103 additions and 21 deletions

View file

@ -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;
}
}
/**