Re-apply: Factors out permissions check from User into PermissionManager service
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiIntegrationTestCase.php
index 999ba47..a5c9ab1 100644 (file)
@@ -1220,8 +1220,23 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
        }
 
        /**
+        * Overrides specific user permissions until services are reloaded
         *
         * @since 1.34
+        *
+        * @param User $user
+        * @param string[]|string $permissions
+        *
+        * @throws Exception
+        */
+       public function overrideUserPermissions( $user, $permissions = [] ) {
+               MediaWikiServices::getInstance()->getPermissionManager()->overrideUserRightsForTesting(
+                       $user,
+                       $permissions
+               );
+       }
+
+       /**
         * Sets the logger for a specified channel, for the duration of the test.
         * @since 1.27
         * @param string $channel