Replace WikiPage::doEdit() usages
authorReedy <reedy@wikimedia.org>
Thu, 15 Sep 2016 20:13:22 +0000 (21:13 +0100)
committerReedy <reedy@wikimedia.org>
Thu, 15 Sep 2016 20:25:32 +0000 (21:25 +0100)
Update/add some comments

Bug: T145737
Change-Id: Ib3b2b69906074cbb51917dc57204c989fd6c58b2

includes/Title.php
includes/api/ApiEditPage.php
tests/phpunit/includes/api/ApiQueryAllPagesTest.php
tests/phpunit/includes/api/query/ApiQueryRevisionsTest.php
tests/phpunit/includes/page/WikiPageTest.php
tests/phpunit/includes/user/UserTest.php

index a8b8ad1..6d9ddd6 100644 (file)
@@ -3258,7 +3258,7 @@ class Title implements LinkTarget {
         * This clears some fields in this object, and clears any associated
         * keys in the "bad links" section of the link cache.
         *
-        * - This is called from WikiPage::doEdit() and WikiPage::insertOn() to allow
+        * - This is called from WikiPage::doEditContent() and WikiPage::insertOn() to allow
         * loading of the new page_id. It's also called from
         * WikiPage::doDeleteArticleReal()
         *
index ee9150c..d6de834 100644 (file)
@@ -532,7 +532,7 @@ class ApiEditPage extends ApiBase {
 
                        case EditPage::AS_END:
                        default:
-                               // $status came from WikiPage::doEdit()
+                               // $status came from WikiPage::doEditContent()
                                $errors = $status->getErrorsArray();
                                $this->dieUsageMsg( $errors[0] ); // TODO: Add new errors to message map
                                break;
index 3b21ff8..7687236 100644 (file)
@@ -20,7 +20,11 @@ class ApiQueryAllPagesTest extends ApiTestCase {
        public function testPrefixNormalizationSearchBug() {
                $title = Title::newFromText( 'Category:Template:xyz' );
                $page = WikiPage::factory( $title );
-               $page->doEdit( 'Some text', 'inserting content' );
+
+               $page->doEditContent(
+                       ContentHandler::makeContent( 'Some text', $page->getTitle() ),
+                       'inserting content'
+               );
 
                $result = $this->doApiRequest( [
                        'action' => 'query',
index a6f22b1..38a1d68 100644 (file)
@@ -15,7 +15,11 @@ class ApiQueryRevisionsTest extends ApiTestCase {
                $pageName = 'Help:' . __METHOD__;
                $title = Title::newFromText( $pageName );
                $page = WikiPage::factory( $title );
-               $page->doEdit( 'Some text', 'inserting content' );
+
+               $page->doEditContent(
+                       ContentHandler::makeContent( 'Some text', $page->getTitle() ),
+                       'inserting content'
+               );
 
                $apiResult = $this->doApiRequest( [
                        'action' => 'query',
index 10e0f59..e55efee 100644 (file)
@@ -154,6 +154,7 @@ class WikiPageTest extends MediaWikiLangTestCase {
 
        /**
         * @covers WikiPage::doEdit
+        * @deprecated since 1.21. Should be removed when WikiPage::doEdit() gets removed
         */
        public function testDoEdit() {
                $this->hideDeprecated( "WikiPage::doEdit" );
index 985554b..34548c0 100644 (file)
@@ -269,7 +269,14 @@ class UserTest extends MediaWikiTestCase {
                // let the user have a few (3) edits
                $page = WikiPage::factory( Title::newFromText( 'Help:UserTest_EditCount' ) );
                for ( $i = 0; $i < 3; $i++ ) {
-                       $page->doEdit( (string)$i, 'test', 0, false, $user );
+
+                       $page->doEditContent(
+                               ContentHandler::makeContent( (string)$i, $page->getTitle() ),
+                               'test',
+                               0,
+                               false,
+                               $user
+                       );
                }
 
                $this->assertEquals(