From: Marius Hoch Date: Fri, 12 Jul 2013 20:40:34 +0000 (+0200) Subject: Don't cache in User::isEveryoneAllowed during unit tests X-Git-Tag: 1.31.0-rc.0~19198 X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=d50479979baf26106709d99b9f84ba4fe6d83de3 Don't cache in User::isEveryoneAllowed during unit tests Extension unit tests depend on being able to change these mid-request (that would never happen during normal usage). Change-Id: Ic32da022cf774341631686e6345969acc1aa5055 --- diff --git a/includes/User.php b/includes/User.php index fa489b36f7..685bce741f 100644 --- a/includes/User.php +++ b/includes/User.php @@ -4000,7 +4000,9 @@ class User { global $wgGroupPermissions, $wgRevokePermissions; static $cache = array(); - if ( isset( $cache[$right] ) ) { + // Use the cached results, except in unit tests which rely on + // being able change the permission mid-request + if ( isset( $cache[$right] ) && !defined( 'MW_PHPUNIT_TEST' ) ) { return $cache[$right]; }