Revision::getText() was removed
authorReedy <reedy@wikimedia.org>
Thu, 19 Jan 2017 01:57:38 +0000 (01:57 +0000)
committerReedy <reedy@wikimedia.org>
Thu, 19 Jan 2017 01:57:38 +0000 (01:57 +0000)
Bug: T154498
Change-Id: I29dcf768a9c176ca27b94359ac99cdc2b5ea930b

RELEASE-NOTES-1.29
includes/Revision.php
tests/phpunit/includes/RevisionStorageTest.php
tests/phpunit/includes/RevisionTest.php

index cbfd124..bc5af86 100644 (file)
@@ -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 ==
 
index 8721ef9..d9e42ff 100644 (file)
@@ -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
index 7d3007b..642ada2 100644 (file)
@@ -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
         */
index 767c963..c971a40 100644 (file)
@@ -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() );