Merge "Drop mediawiki.dic, useless and poorly updated"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiEditPageTest.php
index a35613c..5e5fea3 100644 (file)
@@ -39,7 +39,7 @@ class ApiEditPageTest extends ApiTestCase {
                        $this->tablesUsed,
                        [ 'change_tag', 'change_tag_def', 'logging' ]
                );
-               $this->overrideMwServices();
+               $this->resetServices();
        }
 
        public function testEdit() {
@@ -411,10 +411,10 @@ class ApiEditPageTest extends ApiTestCase {
                $count++;
 
                /*
-               * T43990: if the target page has a newer revision than the redirect, then editing the
-               * redirect while specifying 'redirect' and *not* specifying 'basetimestamp' erroneously
-               * caused an edit conflict to be detected.
-               */
+                * T43990: if the target page has a newer revision than the redirect, then editing the
+                * redirect while specifying 'redirect' and *not* specifying 'basetimestamp' erroneously
+                * caused an edit conflict to be detected.
+                */
 
                // assume NS_HELP defaults to wikitext
                $name = "Help:ApiEditPageTest_testEditConflict_redirect_T43990_$count";
@@ -1369,7 +1369,7 @@ class ApiEditPageTest extends ApiTestCase {
                $this->setMwGlobals( 'wgRevokePermissions',
                        [ 'user' => [ 'applychangetags' => true ] ] );
                // Supply services with updated globals
-               $this->overrideMwServices();
+               $this->resetServices();
 
                try {
                        $this->doApiRequestWithToken( [
@@ -1383,57 +1383,6 @@ class ApiEditPageTest extends ApiTestCase {
                }
        }
 
-       public function testEditAbortedByHook() {
-               $name = 'Help:' . ucfirst( __FUNCTION__ );
-
-               $this->setExpectedException( ApiUsageException::class,
-                       'The modification you tried to make was aborted by an extension.' );
-
-               $this->hideDeprecated( 'APIEditBeforeSave hook (used in ' .
-                       'hook-APIEditBeforeSave-closure)' );
-
-               $this->setTemporaryHook( 'APIEditBeforeSave',
-                       function () {
-                               return false;
-                       }
-               );
-
-               try {
-                       $this->doApiRequestWithToken( [
-                               'action' => 'edit',
-                               'title' => $name,
-                               'text' => 'Some text',
-                       ] );
-               } finally {
-                       $this->assertFalse( Title::newFromText( $name )->exists() );
-               }
-       }
-
-       public function testEditAbortedByHookWithCustomOutput() {
-               $name = 'Help:' . ucfirst( __FUNCTION__ );
-
-               $this->hideDeprecated( 'APIEditBeforeSave hook (used in ' .
-                       'hook-APIEditBeforeSave-closure)' );
-
-               $this->setTemporaryHook( 'APIEditBeforeSave',
-                       function ( $unused1, $unused2, &$r ) {
-                               $r['msg'] = 'Some message';
-                               return false;
-                       } );
-
-               $result = $this->doApiRequestWithToken( [
-                       'action' => 'edit',
-                       'title' => $name,
-                       'text' => 'Some text',
-               ] );
-               Wikimedia\restoreWarnings();
-
-               $this->assertSame( [ 'msg' => 'Some message', 'result' => 'Failure' ],
-                       $result[0]['edit'] );
-
-               $this->assertFalse( Title::newFromText( $name )->exists() );
-       }
-
        public function testEditAbortedByEditPageHookWithResult() {
                $name = 'Help:' . ucfirst( __FUNCTION__ );
 
@@ -1550,7 +1499,7 @@ class ApiEditPageTest extends ApiTestCase {
                $this->setMwGlobals( 'wgRevokePermissions',
                        [ 'user' => [ 'upload' => true ] ] );
                // Supply services with updated globals
-               $this->overrideMwServices();
+               $this->resetServices();
 
                $this->doApiRequestWithToken( [
                        'action' => 'edit',
@@ -1567,7 +1516,7 @@ class ApiEditPageTest extends ApiTestCase {
 
                $this->setMwGlobals( 'wgMaxArticleSize', 1 );
                // Supply services with updated globals
-               $this->overrideMwServices();
+               $this->resetServices();
 
                $text = str_repeat( '!', 1025 );
 
@@ -1586,7 +1535,7 @@ class ApiEditPageTest extends ApiTestCase {
 
                $this->setMwGlobals( 'wgRevokePermissions', [ '*' => [ 'edit' => true ] ] );
                // Supply services with updated globals
-               $this->overrideMwServices();
+               $this->resetServices();
 
                $this->doApiRequestWithToken( [
                        'action' => 'edit',
@@ -1604,7 +1553,7 @@ class ApiEditPageTest extends ApiTestCase {
                $this->setMwGlobals( 'wgRevokePermissions',
                        [ 'user' => [ 'editcontentmodel' => true ] ] );
                // Supply services with updated globals
-               $this->overrideMwServices();
+               $this->resetServices();
 
                $this->doApiRequestWithToken( [
                        'action' => 'edit',