Commit 35f2d746 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic

Cached user data should not be used when running tests

behatnotneeded

Change-Id: Ieed939662ccbe48fa94de8d80a9c0532a6abdaab
parent 4bc0ad5b
......@@ -614,7 +614,7 @@ class ArtefactTypeComment extends ArtefactType {
*/
public static function can_moderate_comments($userid, $artefact=null, $view=null) {
static $usercache = array();
if (array_key_exists($userid, $usercache)) {
if (array_key_exists($userid, $usercache) && !defined('BEHAT_TEST')) {
return $usercache[$userid];
}
......
......@@ -1222,7 +1222,7 @@ function get_user_for_display($user=null) {
'studentid',
);
if (is_numeric($user) && isset($usercache[$user])) {
if (is_numeric($user) && isset($usercache[$user]) && !defined('BEHAT_TEST')) {
return $usercache[$user];
}
......@@ -1256,7 +1256,7 @@ function get_user_for_display($user=null) {
$user->id = null;
}
if (is_numeric($user->id)) {
if (is_numeric($user->id) && !defined('BEHAT_TEST')) {
if (!isset($usercache[$user->id])) {
return $usercache[$user->id] = $user;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment