From 0958f53373671e212f01bf3987e405c6121a2d70 Mon Sep 17 00:00:00 2001 From: Reedy Date: Thu, 19 Jan 2017 01:57:38 +0000 Subject: [PATCH] Revision::getText() was removed Bug: T154498 Change-Id: I29dcf768a9c176ca27b94359ac99cdc2b5ea930b --- RELEASE-NOTES-1.29 | 3 +- includes/Revision.php | 22 --------------- .../phpunit/includes/RevisionStorageTest.php | 12 -------- tests/phpunit/includes/RevisionTest.php | 28 ------------------- 4 files changed, 2 insertions(+), 63 deletions(-) diff --git a/RELEASE-NOTES-1.29 b/RELEASE-NOTES-1.29 index cbfd124b99..bc5af86779 100644 --- a/RELEASE-NOTES-1.29 +++ b/RELEASE-NOTES-1.29 @@ -201,7 +201,8 @@ changes to languages because of Phabricator reports. Use ContentHandlerDefaultModelFor instead. * Hook TitleIsWikitextPage (deprecated in 1.21) was removed. Use ContentHandlerDefaultModelFor instead. -* Article::getContent (deprecated in 1.21) was removed. +* Article::getContent() (deprecated in 1.21) was removed. +* Revision::getText() (deprecated in 1.21) was removed. == Compatibility == diff --git a/includes/Revision.php b/includes/Revision.php index 8721ef9a56..d9e42ffd8b 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1035,28 +1035,6 @@ class Revision implements IDBAccessObject { return (int)$this->mDeleted; } - /** - * Fetch revision text if it's available to the specified audience. - * If the specified audience does not have the ability to view this - * revision, an empty string will be returned. - * - * @param int $audience One of: - * Revision::FOR_PUBLIC to be displayed to all users - * Revision::FOR_THIS_USER to be displayed to the given user - * Revision::RAW get the text regardless of permissions - * @param User $user User object to check for, only if FOR_THIS_USER is passed - * to the $audience parameter - * - * @deprecated since 1.21, use getContent() instead - * @return string - */ - public function getText( $audience = self::FOR_PUBLIC, User $user = null ) { - wfDeprecated( __METHOD__, '1.21' ); - - $content = $this->getContent( $audience, $user ); - return ContentHandler::getContentText( $content ); # returns the raw content text, if applicable - } - /** * Fetch revision content if it's available to the specified audience. * If the specified audience does not have the ability to view this diff --git a/tests/phpunit/includes/RevisionStorageTest.php b/tests/phpunit/includes/RevisionStorageTest.php index 7d3007bf40..642ada20f2 100644 --- a/tests/phpunit/includes/RevisionStorageTest.php +++ b/tests/phpunit/includes/RevisionStorageTest.php @@ -274,18 +274,6 @@ class RevisionStorageTest extends MediaWikiTestCase { $this->assertEquals( $page->getId(), $rev->getPage() ); } - /** - * @covers Revision::getText - */ - public function testGetText() { - $this->hideDeprecated( 'Revision::getText' ); - - $orig = $this->makeRevision( [ 'text' => 'hello hello.' ] ); - $rev = Revision::newFromId( $orig->getId() ); - - $this->assertEquals( 'hello hello.', $rev->getText() ); - } - /** * @covers Revision::getContent */ diff --git a/tests/phpunit/includes/RevisionTest.php b/tests/phpunit/includes/RevisionTest.php index 767c963b66..c971a40cc9 100644 --- a/tests/phpunit/includes/RevisionTest.php +++ b/tests/phpunit/includes/RevisionTest.php @@ -311,28 +311,6 @@ class RevisionTest extends MediaWikiTestCase { ); } - function dataGetText() { - // NOTE: we expect the help namespace to always contain wikitext - return [ - [ 'hello world', 'Help:Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ], - [ serialize( 'hello world' ), 'Hello', "testing", null, Revision::FOR_PUBLIC, null ], - [ serialize( 'hello world' ), 'Dummy:Hello', null, null, Revision::FOR_PUBLIC, null ], - ]; - } - - /** - * @group Database - * @dataProvider dataGetText - * @covers Revision::getText - */ - public function testGetText( $text, $title, $model, $format, $audience, $expectedText ) { - $this->hideDeprecated( 'Revision::getText' ); - - $rev = $this->newTestRevision( $text, $title, $model, $format ); - - $this->assertEquals( $expectedText, $rev->getText( $audience ) ); - } - public function dataGetSize() { return [ [ "hello world.", CONTENT_MODEL_WIKITEXT, 12 ], @@ -375,14 +353,11 @@ class RevisionTest extends MediaWikiTestCase { * @covers Revision::__construct */ public function testConstructWithText() { - $this->hideDeprecated( "Revision::getText" ); - $rev = new Revision( [ 'text' => 'hello world.', 'content_model' => CONTENT_MODEL_JAVASCRIPT ] ); - $this->assertNotNull( $rev->getText(), 'no content text' ); $this->assertNotNull( $rev->getContent(), 'no content object available' ); $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContent()->getModel() ); $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() ); @@ -392,15 +367,12 @@ class RevisionTest extends MediaWikiTestCase { * @covers Revision::__construct */ public function testConstructWithContent() { - $this->hideDeprecated( "Revision::getText" ); - $title = Title::newFromText( 'RevisionTest_testConstructWithContent' ); $rev = new Revision( [ 'content' => ContentHandler::makeContent( 'hello world.', $title, CONTENT_MODEL_JAVASCRIPT ), ] ); - $this->assertNotNull( $rev->getText(), 'no content text' ); $this->assertNotNull( $rev->getContent(), 'no content object available' ); $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContent()->getModel() ); $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() ); -- 2.20.1