X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fpage%2FWikiPageDbTestBase.php;h=e4134b8ff75eea031d635b5d91368c023855a8dd;hb=b8020d80168dfac2e999251b0f96673c395d87ce;hp=f7e5bd161a57ebbded304aa1eaf06b18b4b6ae19;hpb=28eb73531eec408d4115d982a7da2fc9e93b0ddf;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/page/WikiPageDbTestBase.php b/tests/phpunit/includes/page/WikiPageDbTestBase.php index f7e5bd161a..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() ); } /** @@ -1560,89 +1560,6 @@ more stuff $this->assertTrue( $page->wasLoadedFrom( IDBAccessObject::READ_EXCLUSIVE ) ); } - /** - * @dataProvider provideCommentMigrationOnDeletion - * - * @param int $writeStage - * @param int $readStage - */ - public function testCommentMigrationOnDeletion( $writeStage, $readStage ) { - $this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', $writeStage ); - $this->overrideMwServices(); - - $dbr = wfGetDB( DB_REPLICA ); - - $page = $this->createPage( - __METHOD__, - "foo", - CONTENT_MODEL_WIKITEXT - ); - $revid = $page->getLatest(); - if ( $writeStage > MIGRATION_OLD ) { - $comment_id = $dbr->selectField( - 'revision_comment_temp', - 'revcomment_comment_id', - [ 'revcomment_rev' => $revid ], - __METHOD__ - ); - } - - $this->setMwGlobals( 'wgCommentTableSchemaMigrationStage', $readStage ); - $this->overrideMwServices(); - - $page->doDeleteArticle( "testing deletion" ); - - if ( $readStage > MIGRATION_OLD ) { - // Didn't leave behind any 'revision_comment_temp' rows - $n = $dbr->selectField( - 'revision_comment_temp', 'COUNT(*)', [ 'revcomment_rev' => $revid ], __METHOD__ - ); - $this->assertEquals( 0, $n, 'no entry in revision_comment_temp after deletion' ); - - // Copied or upgraded the comment_id, as applicable - $ar_comment_id = $dbr->selectField( - 'archive', - 'ar_comment_id', - [ 'ar_rev_id' => $revid ], - __METHOD__ - ); - if ( $writeStage > MIGRATION_OLD ) { - $this->assertSame( $comment_id, $ar_comment_id ); - } else { - $this->assertNotEquals( 0, $ar_comment_id ); - } - } - - // Copied rev_comment, if applicable - if ( $readStage <= MIGRATION_WRITE_BOTH && $writeStage <= MIGRATION_WRITE_BOTH ) { - $ar_comment = $dbr->selectField( - 'archive', - 'ar_comment', - [ 'ar_rev_id' => $revid ], - __METHOD__ - ); - $this->assertSame( 'testing', $ar_comment ); - } - } - - public function provideCommentMigrationOnDeletion() { - return [ - [ MIGRATION_OLD, MIGRATION_OLD ], - [ MIGRATION_OLD, MIGRATION_WRITE_BOTH ], - [ MIGRATION_OLD, MIGRATION_WRITE_NEW ], - [ MIGRATION_WRITE_BOTH, MIGRATION_OLD ], - [ MIGRATION_WRITE_BOTH, MIGRATION_WRITE_BOTH ], - [ MIGRATION_WRITE_BOTH, MIGRATION_WRITE_NEW ], - [ MIGRATION_WRITE_BOTH, MIGRATION_NEW ], - [ MIGRATION_WRITE_NEW, MIGRATION_WRITE_BOTH ], - [ MIGRATION_WRITE_NEW, MIGRATION_WRITE_NEW ], - [ MIGRATION_WRITE_NEW, MIGRATION_NEW ], - [ MIGRATION_NEW, MIGRATION_WRITE_BOTH ], - [ MIGRATION_NEW, MIGRATION_WRITE_NEW ], - [ MIGRATION_NEW, MIGRATION_NEW ], - ]; - } - /** * @covers WikiPage::updateCategoryCounts */ @@ -1900,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() ); } @@ -2048,7 +1965,7 @@ more stuff wfTimestamp( TS_UNIX, $initialRevision->getTimestamp() ) - 1 ); - $olderRevison = new Revision( + $olderRevision = new Revision( [ 'id' => 9989, 'page' => $page->getId(), @@ -2065,7 +1982,7 @@ more stuff ] ); - $result = $page->updateIfNewerOn( $this->db, $olderRevison ); + $result = $page->updateIfNewerOn( $this->db, $olderRevision ); $this->assertFalse( $result ); }