Don't cache in User::isEveryoneAllowed during unit tests
authorMarius Hoch <hoo@online.de>
Fri, 12 Jul 2013 20:40:34 +0000 (22:40 +0200)
committerMarius Hoch <hoo@online.de>
Fri, 12 Jul 2013 20:43:29 +0000 (22:43 +0200)
Extension unit tests depend on being able to change these
mid-request (that would never happen during normal usage).

Change-Id: Ic32da022cf774341631686e6345969acc1aa5055

includes/User.php

index fa489b3..685bce7 100644 (file)
@@ -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];
                }