From d993f499ee66a9296bcb09f7e3a93eadd8274bb6 Mon Sep 17 00:00:00 2001 From: Bill Pirkle Date: Wed, 6 Feb 2019 18:14:23 -0600 Subject: [PATCH] Refactor calls to deprecated function Content::getNativeData() Function Content::getNativeData() was deprecated. Replace with calls to new function TextContent::getText() in most places. Bug: T155582 Change-Id: I2bd508c72aac4faf474ba45ab1f92e2e8d2eb9be --- includes/FeedUtils.php | 2 +- includes/LinkFilter.php | 2 +- includes/actions/RawAction.php | 2 +- includes/api/ApiFeedContributions.php | 2 +- includes/api/ApiParse.php | 2 +- includes/api/ApiQueryRevisionsBase.php | 4 +- includes/content/ContentHandler.php | 2 +- includes/specials/SpecialBooksources.php | 2 +- includes/specials/SpecialUndelete.php | 2 +- languages/LanguageConverter.php | 2 +- maintenance/compareParsers.php | 2 +- maintenance/preprocessDump.php | 2 +- maintenance/view.php | 2 +- .../includes/Revision/SlotRecordTest.php | 8 ++-- tests/phpunit/includes/RevisionDbTestBase.php | 4 +- .../phpunit/includes/api/ApiEditPageTest.php | 38 +++++++++---------- .../includes/diff/CustomDifferenceEngine.php | 2 +- tests/phpunit/includes/import/ImportTest.php | 2 +- .../phpunit/includes/page/ArticleViewTest.php | 10 ++--- .../includes/page/WikiPageDbTestBase.php | 16 ++++---- .../mocks/content/DummyContentForTesting.php | 4 +- .../mocks/content/DummyNonTextContent.php | 4 +- 22 files changed, 57 insertions(+), 59 deletions(-) diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 4dde52d0b4..899ac09ad2 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -173,7 +173,7 @@ class FeedUtils { if ( $newContent instanceof TextContent ) { // only textual content has a "source view". - $text = $newContent->getNativeData(); + $text = $newContent->getText(); if ( $wgFeedDiffCutoff <= 0 || strlen( $text ) > $wgFeedDiffCutoff ) { $html = null; diff --git a/includes/LinkFilter.php b/includes/LinkFilter.php index ffb36e0ba1..a4e94da7cf 100644 --- a/includes/LinkFilter.php +++ b/includes/LinkFilter.php @@ -54,7 +54,7 @@ class LinkFilter { return 0; } - $text = $content->getNativeData(); + $text = $content->getText(); $regex = self::makeRegex( $filterEntry, $protocol ); return preg_match( $regex, $text ); diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index 77a8b14e2c..73594bce3a 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -215,7 +215,7 @@ class RawAction extends FormlessAction { // section not found (or section not supported, e.g. for JS, JSON, and CSS) $text = false; } else { - $text = $content->getNativeData(); + $text = $content->getText(); } } } diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index 9edf929f8e..2492db2070 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -181,7 +181,7 @@ class ApiFeedContributions extends ApiBase { if ( $content instanceof TextContent ) { // only textual content has a "source view". - $html = nl2br( htmlspecialchars( $content->getNativeData() ) ); + $html = nl2br( htmlspecialchars( $content->getText() ) ); } else { // XXX: we could get an HTML representation of the content via getParserOutput, but that may // contain JS magic and generally may not be suitable for inclusion in a feed. diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 148ac67626..9f561b7513 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -487,7 +487,7 @@ class ApiParse extends ApiBase { } $wgParser->startExternalParse( $titleObj, $popts, Parser::OT_PREPROCESS ); - $xml = $wgParser->preprocessToDom( $this->content->getNativeData() )->__toString(); + $xml = $wgParser->preprocessToDom( $this->content->getText() )->__toString(); $result_array['parsetree'] = $xml; $result_array[ApiResult::META_BC_SUBELEMENTS][] = 'parsetree'; } diff --git a/includes/api/ApiQueryRevisionsBase.php b/includes/api/ApiQueryRevisionsBase.php index 3d0a0fba62..0d2aeab199 100644 --- a/includes/api/ApiQueryRevisionsBase.php +++ b/includes/api/ApiQueryRevisionsBase.php @@ -471,7 +471,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase { if ( $this->fld_parsetree || ( $this->fld_content && $this->generateXML ) ) { if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) { - $t = $content->getNativeData(); # note: don't set $text + $t = $content->getText(); # note: don't set $text $wgParser->startExternalParse( $title, @@ -503,7 +503,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase { if ( $this->expandTemplates && !$this->parseContent ) { if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) { - $text = $content->getNativeData(); + $text = $content->getText(); $text = $wgParser->preprocess( $text, diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index ae47b86056..49e3132275 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -59,7 +59,7 @@ abstract class ContentHandler { * If $content is null, this method returns the empty string. * * If $content is an instance of TextContent, this method returns the flat - * text as returned by $content->getNativeData(). + * text as returned by $content->getText(). * * If $content is not a TextContent object, the behavior of this method * depends on the global $wgContentHandlerTextFallback: diff --git a/includes/specials/SpecialBooksources.php b/includes/specials/SpecialBooksources.php index 02c33b543f..2fe38ed215 100644 --- a/includes/specials/SpecialBooksources.php +++ b/includes/specials/SpecialBooksources.php @@ -171,7 +171,7 @@ class SpecialBookSources extends SpecialPage { if ( $content instanceof TextContent ) { // XXX: in the future, this could be stored as structured data, defining a list of book sources - $text = $content->getNativeData(); + $text = $content->getText(); $out->addWikiTextAsInterface( str_replace( 'MAGICNUMBER', $isbn, $text ) ); return true; diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 9654bb7093..3e560ada45 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -493,7 +493,7 @@ class SpecialUndelete extends SpecialPage { 'readonly' => 'readonly', 'cols' => 80, 'rows' => 25 - ], $content->getNativeData() . "\n" ); + ], $content->getText() . "\n" ); $buttonFields[] = new OOUI\ButtonInputWidget( [ 'type' => 'submit', diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 006e3b7160..8aa7c87a9e 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -1033,7 +1033,7 @@ class LanguageConverter { $revision = Revision::newFromTitle( $title ); if ( $revision ) { if ( $revision->getContentModel() == CONTENT_MODEL_WIKITEXT ) { - $txt = $revision->getContent( Revision::RAW )->getNativeData(); + $txt = $revision->getContent( Revision::RAW )->getText(); } // @todo in the future, use a specialized content model, perhaps based on json! diff --git a/maintenance/compareParsers.php b/maintenance/compareParsers.php index b01dde6ee2..2f0bcdf2a2 100644 --- a/maintenance/compareParsers.php +++ b/maintenance/compareParsers.php @@ -144,7 +144,7 @@ class CompareParsers extends DumpIterator { return; } - $text = strval( $content->getNativeData() ); + $text = strval( $content->getText() ); $output1 = $parser1->parse( $text, $title, $this->options ); $output2 = $parser2->parse( $text, $title, $this->options ); diff --git a/maintenance/preprocessDump.php b/maintenance/preprocessDump.php index d540e8f902..f8526d0c33 100644 --- a/maintenance/preprocessDump.php +++ b/maintenance/preprocessDump.php @@ -86,7 +86,7 @@ class PreprocessDump extends DumpIterator { } try { - $this->mPreprocessor->preprocessToObj( strval( $content->getNativeData() ), 0 ); + $this->mPreprocessor->preprocessToObj( strval( $content->getText() ), 0 ); } catch ( Exception $e ) { $this->error( "Caught exception " . $e->getMessage() . " in " . $rev->getTitle()->getPrefixedText() ); diff --git a/maintenance/view.php b/maintenance/view.php index 952b8253ee..24b5007745 100644 --- a/maintenance/view.php +++ b/maintenance/view.php @@ -51,7 +51,7 @@ class ViewCLI extends Maintenance { $this->fatalError( "Non-text content models not supported" ); } - $this->output( $content->getNativeData() ); + $this->output( $content->getText() ); } } diff --git a/tests/phpunit/includes/Revision/SlotRecordTest.php b/tests/phpunit/includes/Revision/SlotRecordTest.php index ea26808355..1b6ff2aace 100644 --- a/tests/phpunit/includes/Revision/SlotRecordTest.php +++ b/tests/phpunit/includes/Revision/SlotRecordTest.php @@ -39,7 +39,7 @@ class SlotRecordTest extends MediaWikiTestCase { $this->assertTrue( $record->hasContentId() ); $this->assertTrue( $record->hasRevision() ); $this->assertTrue( $record->isInherited() ); - $this->assertSame( 'A', $record->getContent()->getNativeData() ); + $this->assertSame( 'A', $record->getContent()->getText() ); $this->assertSame( 5, $record->getSize() ); $this->assertSame( 'someHash', $record->getSha1() ); $this->assertSame( CONTENT_MODEL_WIKITEXT, $record->getModel() ); @@ -75,7 +75,7 @@ class SlotRecordTest extends MediaWikiTestCase { $this->assertTrue( $record->hasRevision() ); $this->assertFalse( $record->hasContentId() ); $this->assertFalse( $record->isInherited() ); - $this->assertSame( 'A', $record->getContent()->getNativeData() ); + $this->assertSame( 'A', $record->getContent()->getText() ); $this->assertSame( 1, $record->getSize() ); $this->assertNotNull( $record->getSha1() ); $this->assertSame( CONTENT_MODEL_WIKITEXT, $record->getModel() ); @@ -94,7 +94,7 @@ class SlotRecordTest extends MediaWikiTestCase { $this->assertFalse( $record->hasRevision() ); $this->assertFalse( $record->isInherited() ); $this->assertFalse( $record->hasOrigin() ); - $this->assertSame( 'A', $record->getContent()->getNativeData() ); + $this->assertSame( 'A', $record->getContent()->getText() ); $this->assertSame( 1, $record->getSize() ); $this->assertNotNull( $record->getSha1() ); $this->assertSame( CONTENT_MODEL_WIKITEXT, $record->getModel() ); @@ -237,7 +237,7 @@ class SlotRecordTest extends MediaWikiTestCase { $this->assertTrue( $saved->hasContentId() ); $this->assertSame( 'theNewAddress', $saved->getAddress() ); $this->assertSame( 20, $saved->getContentId() ); - $this->assertSame( 'A', $saved->getContent()->getNativeData() ); + $this->assertSame( 'A', $saved->getContent()->getText() ); $this->assertSame( 10, $saved->getRevision() ); $this->assertSame( 10, $saved->getOrigin() ); diff --git a/tests/phpunit/includes/RevisionDbTestBase.php b/tests/phpunit/includes/RevisionDbTestBase.php index 339dc30890..a17d21dbad 100644 --- a/tests/phpunit/includes/RevisionDbTestBase.php +++ b/tests/phpunit/includes/RevisionDbTestBase.php @@ -657,7 +657,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { 'new null revision should have the same SHA1 as the original revision' ); $this->assertTrue( $orig->getRevisionRecord()->hasSameContent( $rev->getRevisionRecord() ), 'new null revision should have the same content as the original revision' ); - $this->assertEquals( __METHOD__, $rev->getContent()->getNativeData() ); + $this->assertEquals( __METHOD__, $rev->getContent()->getText() ); } /** @@ -1379,7 +1379,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { ); $rev = $this->testPage->getRevision(); - $this->assertSame( $expectedText, $rev->getContent()->getNativeData() ); + $this->assertSame( $expectedText, $rev->getContent()->getText() ); $this->assertSame( $expectedText, $rev->getSerializedData() ); $this->assertSame( $this->testPage->getContentModel(), $rev->getContentModel() ); $this->assertSame( $this->testPage->getContent()->getDefaultFormat(), $rev->getContentFormat() ); diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index 2161093311..de0af0b858 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -152,7 +152,7 @@ class ApiEditPageTest extends ApiTestCase { $content = $page->getContent(); $this->assertNotNull( $content, 'Page should have been created' ); - $text = $content->getNativeData(); + $text = $content->getText(); $this->assertSame( $expected, $text ); } @@ -176,7 +176,7 @@ class ApiEditPageTest extends ApiTestCase { $this->assertSame( 'Success', $re['edit']['result'] ); $newtext = WikiPage::factory( Title::newFromText( $name ) ) ->getContent( Revision::RAW ) - ->getNativeData(); + ->getText(); $this->assertSame( "==section 1==\nnew content 1\n\n==section 2==\ncontent2", $newtext ); // Test that we raise a 'nosuchsection' error @@ -216,7 +216,7 @@ class ApiEditPageTest extends ApiTestCase { // Check the page text is correct $text = WikiPage::factory( Title::newFromText( $name ) ) ->getContent( Revision::RAW ) - ->getNativeData(); + ->getText(); $this->assertSame( "== header ==\n\ntest", $text ); // Now on one that does @@ -232,7 +232,7 @@ class ApiEditPageTest extends ApiTestCase { $this->assertSame( 'Success', $re2['edit']['result'] ); $text = WikiPage::factory( Title::newFromText( $name ) ) ->getContent( Revision::RAW ) - ->getNativeData(); + ->getText(); $this->assertSame( "== header ==\n\ntest\n\n== header ==\n\ntest", $text ); } @@ -733,7 +733,7 @@ class ApiEditPageTest extends ApiTestCase { 'undoafter' => $revId1, ] ); - $text = ( new WikiPage( $titleObj ) )->getContent()->getNativeData(); + $text = ( new WikiPage( $titleObj ) )->getContent()->getText(); // This is wrong! It should be 1. But let's test for our incorrect // behavior for now, so if someone fixes it they'll fix the test as @@ -761,7 +761,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); $text = ( new WikiPage( Title::newFromText( $name ) ) )->getContent() - ->getNativeData(); + ->getText(); $this->assertSame( '3', $text ); } @@ -784,7 +784,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); $text = ( new WikiPage( Title::newFromText( $name ) ) )->getContent() - ->getNativeData(); + ->getText(); $this->assertSame( '1', $text ); } @@ -855,7 +855,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); $text = ( new WikiPage( Title::newFromText( $name ) ) ) - ->getContent()->getNativeData(); + ->getContent()->getText(); $this->assertSame( 'Alert: Some text', $text ); } @@ -872,7 +872,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); $text = ( new WikiPage( Title::newFromText( $name ) ) ) - ->getContent()->getNativeData(); + ->getContent()->getText(); $this->assertSame( 'Some text is nice', $text ); } @@ -890,7 +890,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); $text = ( new WikiPage( Title::newFromText( $name ) ) ) - ->getContent()->getNativeData(); + ->getContent()->getText(); $this->assertSame( 'Alert: Some text is nice', $text ); } @@ -957,7 +957,7 @@ class ApiEditPageTest extends ApiTestCase { } finally { // Validate that content was not changed $text = ( new WikiPage( Title::newFromText( $name ) ) ) - ->getContent()->getNativeData(); + ->getContent()->getText(); $this->assertSame( 'Some text', $text ); } @@ -1059,7 +1059,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); $text = ( new WikiPage( Title::newFromText( $name ) ) ) - ->getContent()->getNativeData(); + ->getContent()->getText(); $this->assertSame( "Initial content\n\n== New section ==", $text ); } @@ -1097,7 +1097,7 @@ class ApiEditPageTest extends ApiTestCase { $page = new WikiPage( Title::newFromText( $name ) ); $this->assertSame( "Initial content\n\n== My section ==\n\nMore content", - $page->getContent()->getNativeData() ); + $page->getContent()->getText() ); $this->assertSame( '/* My section */ new section', $page->getRevision()->getComment() ); } @@ -1118,7 +1118,7 @@ class ApiEditPageTest extends ApiTestCase { $page = new WikiPage( Title::newFromText( $name ) ); $this->assertSame( "Initial content\n\n== Add new section ==\n\nMore content", - $page->getContent()->getNativeData() ); + $page->getContent()->getText() ); // EditPage actually assumes the summary is the section name here $this->assertSame( '/* Add new section */ new section', $page->getRevision()->getComment() ); @@ -1141,7 +1141,7 @@ class ApiEditPageTest extends ApiTestCase { $page = new WikiPage( Title::newFromText( $name ) ); $this->assertSame( "Initial content\n\n== My section ==\n\nMore content", - $page->getContent()->getNativeData() ); + $page->getContent()->getText() ); $this->assertSame( 'Add new section', $page->getRevision()->getComment() ); } @@ -1160,7 +1160,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); $text = ( new WikiPage( Title::newFromText( $name ) ) ) - ->getContent()->getNativeData(); + ->getContent()->getText(); $this->assertSame( "== Section 1 ==\n\nContent and more content\n\n" . "== Section 2 ==\n\nFascinating!", $text ); @@ -1179,7 +1179,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); $text = ( new WikiPage( Title::newFromText( $name ) ) ) - ->getContent()->getNativeData(); + ->getContent()->getText(); $this->assertSame( "Content and more content\n\n== Section 1 ==\n\n" . "Fascinating!", $text ); @@ -1201,7 +1201,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); } finally { $text = ( new WikiPage( Title::newFromText( $name ) ) ) - ->getContent()->getNativeData(); + ->getContent()->getText(); $this->assertSame( 'Content', $text ); } @@ -1223,7 +1223,7 @@ class ApiEditPageTest extends ApiTestCase { ] ); } finally { $text = ( new WikiPage( Title::newFromText( $name ) ) ) - ->getContent()->getNativeData(); + ->getContent()->getText(); $this->assertSame( 'Content', $text ); } diff --git a/tests/phpunit/includes/diff/CustomDifferenceEngine.php b/tests/phpunit/includes/diff/CustomDifferenceEngine.php index c760d02978..47cdb15ce1 100644 --- a/tests/phpunit/includes/diff/CustomDifferenceEngine.php +++ b/tests/phpunit/includes/diff/CustomDifferenceEngine.php @@ -7,7 +7,7 @@ class CustomDifferenceEngine extends DifferenceEngine { } public function generateContentDiffBody( Content $old, Content $new ) { - return $old->getNativeData() . '|' . $new->getNativeData(); + return $old->getText() . '|' . $new->getText(); } public function showDiffStyle() { diff --git a/tests/phpunit/includes/import/ImportTest.php b/tests/phpunit/includes/import/ImportTest.php index 892bdcfc0b..2b8122287f 100644 --- a/tests/phpunit/includes/import/ImportTest.php +++ b/tests/phpunit/includes/import/ImportTest.php @@ -33,7 +33,7 @@ class ImportTest extends MediaWikiLangTestCase { $title = Title::newFromText( $title ); $this->assertTrue( $title->exists() ); - $this->assertEquals( WikiPage::factory( $title )->getContent()->getNativeData(), $text ); + $this->assertEquals( WikiPage::factory( $title )->getContent()->getText(), $text ); } public function getUnknownTagsXML() { diff --git a/tests/phpunit/includes/page/ArticleViewTest.php b/tests/phpunit/includes/page/ArticleViewTest.php index 466e209a32..524fbdccef 100644 --- a/tests/phpunit/includes/page/ArticleViewTest.php +++ b/tests/phpunit/includes/page/ArticleViewTest.php @@ -190,8 +190,7 @@ class ArticleViewTest extends MediaWikiTestCase { ->willReturn( new ParserOutput( 'Structured Output' ) ); $content->method( 'getModel' ) ->willReturn( 'NotText' ); - $content->method( 'getNativeData' ) - ->willReturn( [ (object)[ 'x' => 'stuff' ] ] ); + $content->expects( $this->never() )->method( 'getNativeData' ); $content->method( 'copy' ) ->willReturn( $content ); @@ -447,7 +446,7 @@ class ArticleViewTest extends MediaWikiTestCase { 'ArticleContentViewCustom', function ( Content $content, Title $title, OutputPage $output ) use ( $page ) { $this->assertSame( $page->getTitle(), $title, '$title' ); - $this->assertSame( 'Test A', $content->getNativeData(), '$content' ); + $this->assertSame( 'Test A', $content->getText(), '$content' ); $output->addHTML( 'Hook Text' ); return false; @@ -483,9 +482,8 @@ class ArticleViewTest extends MediaWikiTestCase { 'ArticleRevisionViewCustom', function ( RevisionRecord $rev, Title $title, $oldid, OutputPage $output ) use ( $page ) { $content = $rev->getContent( SlotRecord::MAIN ); - $this->assertSame( $page->getTitle(), $title, '$title' ); - $this->assertSame( 'Test A', $content->getNativeData(), '$content' ); + $this->assertSame( 'Test A', $content->getText(), '$content' ); $output->addHTML( 'Hook Text' ); return false; @@ -517,7 +515,7 @@ class ArticleViewTest extends MediaWikiTestCase { 'ArticleAfterFetchContentObject', function ( Article &$articlePage, Content &$content ) use ( $page, $article ) { $this->assertSame( $article, $articlePage, '$articlePage' ); - $this->assertSame( 'Test A', $content->getNativeData(), '$content' ); + $this->assertSame( 'Test A', $content->getText(), '$content' ); $content = new WikitextContent( 'Hook Text' ); } diff --git a/tests/phpunit/includes/page/WikiPageDbTestBase.php b/tests/phpunit/includes/page/WikiPageDbTestBase.php index 933e47dbcd..e4134b8ff7 100644 --- a/tests/phpunit/includes/page/WikiPageDbTestBase.php +++ b/tests/phpunit/includes/page/WikiPageDbTestBase.php @@ -737,7 +737,7 @@ abstract class WikiPageDbTestBase extends MediaWikiLangTestCase { $rev = $page->getRevision(); $this->assertEquals( $page->getLatest(), $rev->getId() ); - $this->assertEquals( "some text", $rev->getContent()->getNativeData() ); + $this->assertEquals( "some text", $rev->getContent()->getText() ); } /** @@ -753,7 +753,7 @@ abstract class WikiPageDbTestBase extends MediaWikiLangTestCase { $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT ); $content = $page->getContent(); - $this->assertEquals( "some text", $content->getNativeData() ); + $this->assertEquals( "some text", $content->getText() ); } /** @@ -1111,7 +1111,7 @@ more stuff $content = ContentHandler::makeContent( $with, $page->getTitle(), $page->getContentModel() ); $c = $page->replaceSectionContent( $section, $content, $sectionTitle ); - $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getNativeData() ) ); + $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getText() ) ); } /** @@ -1127,7 +1127,7 @@ more stuff $content = ContentHandler::makeContent( $with, $page->getTitle(), $page->getContentModel() ); $c = $page->replaceSectionAtRev( $section, $content, $sectionTitle, $baseRevId ); - $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getNativeData() ) ); + $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getText() ) ); } /** @@ -1242,7 +1242,7 @@ more stuff $page = new WikiPage( $page->getTitle() ); $this->assertEquals( $rev2->getSha1(), $page->getRevision()->getSha1(), "rollback did not revert to the correct revision" ); - $this->assertEquals( "one\n\ntwo", $page->getContent()->getNativeData() ); + $this->assertEquals( "one\n\ntwo", $page->getContent()->getText() ); $rc = MediaWikiServices::getInstance()->getRevisionStore()->getRecentChange( $page->getRevision()->getRevisionRecord() @@ -1332,7 +1332,7 @@ more stuff $page = new WikiPage( $page->getTitle() ); $this->assertEquals( $rev1->getSha1(), $page->getRevision()->getSha1(), "rollback did not revert to the correct revision" ); - $this->assertEquals( "one", $page->getContent()->getNativeData() ); + $this->assertEquals( "one", $page->getContent()->getText() ); } /** @@ -1817,8 +1817,8 @@ more stuff $fetchedPage = WikiPage::newFromID( $createdPage->getId() ); $this->assertSame( $createdPage->getId(), $fetchedPage->getId() ); $this->assertEquals( - $createdPage->getContent()->getNativeData(), - $fetchedPage->getContent()->getNativeData() + $createdPage->getContent()->getText(), + $fetchedPage->getContent()->getText() ); } diff --git a/tests/phpunit/mocks/content/DummyContentForTesting.php b/tests/phpunit/mocks/content/DummyContentForTesting.php index 6bc7c4487c..e3cac83c82 100644 --- a/tests/phpunit/mocks/content/DummyContentForTesting.php +++ b/tests/phpunit/mocks/content/DummyContentForTesting.php @@ -104,7 +104,7 @@ class DummyContentForTesting extends AbstractContent { public function getParserOutput( Title $title, $revId = null, ParserOptions $options = null, $generateHtml = true ) { - return new ParserOutput( $this->getNativeData() ); + return new ParserOutput( $this->data ); } /** @@ -118,6 +118,6 @@ class DummyContentForTesting extends AbstractContent { */ protected function fillParserOutput( Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output ) { - $output = new ParserOutput( $this->getNativeData() ); + $output = new ParserOutput( $this->data ); } } diff --git a/tests/phpunit/mocks/content/DummyNonTextContent.php b/tests/phpunit/mocks/content/DummyNonTextContent.php index e65f522640..bdfa8d072b 100644 --- a/tests/phpunit/mocks/content/DummyNonTextContent.php +++ b/tests/phpunit/mocks/content/DummyNonTextContent.php @@ -102,7 +102,7 @@ class DummyNonTextContent extends AbstractContent { public function getParserOutput( Title $title, $revId = null, ParserOptions $options = null, $generateHtml = true ) { - return new ParserOutput( $this->getNativeData() ); + return new ParserOutput( $this->serialize() ); } /** @@ -116,6 +116,6 @@ class DummyNonTextContent extends AbstractContent { */ protected function fillParserOutput( Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output ) { - $output = new ParserOutput( $this->getNativeData() ); + $output = new ParserOutput( $this->serialize() ); } } -- 2.20.1