Test ApiUserrights
[lhc/web/wiklou.git] / tests / phpunit / includes / TestUserRegistry.php
index 4818b49..0c178ca 100644 (file)
@@ -107,4 +107,19 @@ class TestUserRegistry {
        public static function clear() {
                self::$testUsers = [];
        }
+
+       /**
+        * @todo It would be nice if this were a non-static method of TestUser
+        * instead, but that doesn't seem possible without friends?
+        *
+        * @return bool True if it's safe to modify the user
+        */
+       public static function isMutable( User $user ) {
+               foreach ( self::$testUsers as $key => $testUser ) {
+                       if ( $user === $testUser->getUser() ) {
+                               return false;
+                       }
+               }
+               return true;
+       }
 }