From: Reedy Date: Thu, 15 Sep 2016 20:13:22 +0000 (+0100) Subject: Replace WikiPage::doEdit() usages X-Git-Tag: 1.31.0-rc.0~5542^2 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=3c27ff94fa93d924f01500b2dce1e5953a5accc1;p=lhc%2Fweb%2Fwiklou.git Replace WikiPage::doEdit() usages Update/add some comments Bug: T145737 Change-Id: Ib3b2b69906074cbb51917dc57204c989fd6c58b2 --- diff --git a/includes/Title.php b/includes/Title.php index a8b8ad1d71..6d9ddd6ddc 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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() * diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index ee9150cc86..d6de834301 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -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; diff --git a/tests/phpunit/includes/api/ApiQueryAllPagesTest.php b/tests/phpunit/includes/api/ApiQueryAllPagesTest.php index 3b21ff888d..76872362cd 100644 --- a/tests/phpunit/includes/api/ApiQueryAllPagesTest.php +++ b/tests/phpunit/includes/api/ApiQueryAllPagesTest.php @@ -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', diff --git a/tests/phpunit/includes/api/query/ApiQueryRevisionsTest.php b/tests/phpunit/includes/api/query/ApiQueryRevisionsTest.php index a6f22b1c38..38a1d68591 100644 --- a/tests/phpunit/includes/api/query/ApiQueryRevisionsTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryRevisionsTest.php @@ -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', diff --git a/tests/phpunit/includes/page/WikiPageTest.php b/tests/phpunit/includes/page/WikiPageTest.php index 10e0f5962a..e55efeea45 100644 --- a/tests/phpunit/includes/page/WikiPageTest.php +++ b/tests/phpunit/includes/page/WikiPageTest.php @@ -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" ); diff --git a/tests/phpunit/includes/user/UserTest.php b/tests/phpunit/includes/user/UserTest.php index 985554b86d..34548c0481 100644 --- a/tests/phpunit/includes/user/UserTest.php +++ b/tests/phpunit/includes/user/UserTest.php @@ -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(