Fix some issues with HTMLSelectAndOtherField default and validation
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiTestCase.php
index c84ac44..f9416be 100644 (file)
@@ -1130,21 +1130,6 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase {
                $this->setMwGlobals( 'wgGroupPermissions', $newPermissions );
        }
 
-       /**
-        * Overrides specific user permissions until services are reloaded
-        *
-        * @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
@@ -2395,13 +2380,20 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase {
         * @param string $text Content of the page
         * @param string $summary Optional summary string for the revision
         * @param int $defaultNs Optional namespace id
+        * @param User|null $user If null, static::getTestSysop()->getUser() is used.
         * @return Status Object as returned by WikiPage::doEditContent()
         * @throws MWException If this test cases's needsDB() method doesn't return true.
         *         Test cases can use "@group Database" to enable database test support,
         *         or list the tables under testing in $this->tablesUsed, or override the
         *         needsDB() method.
         */
-       protected function editPage( $pageName, $text, $summary = '', $defaultNs = NS_MAIN ) {
+       protected function editPage(
+               $pageName,
+               $text,
+               $summary = '',
+               $defaultNs = NS_MAIN,
+               User $user = null
+       ) {
                if ( !$this->needsDB() ) {
                        throw new MWException( 'When testing which pages, the test cases\'s needsDB()' .
                                ' method should return true. Use @group Database or $this->tablesUsed.' );
@@ -2410,7 +2402,13 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase {
                $title = Title::newFromText( $pageName, $defaultNs );
                $page = WikiPage::factory( $title );
 
-               return $page->doEditContent( ContentHandler::makeContent( $text, $title ), $summary );
+               return $page->doEditContent(
+                       ContentHandler::makeContent( $text, $title ),
+                       $summary,
+                       0,
+                       false,
+                       $user
+               );
        }
 
        /**