[
'page',
'revision',
+ 'comment',
'ip_changes',
'text',
'archive',
$this->setMwGlobals( [
'wgMultiContentRevisionSchemaMigrationStage' => $this->getMcrMigrationStage(),
'wgContentHandlerUseDB' => $this->getContentHandlerUseDB(),
- 'wgCommentTableSchemaMigrationStage' => MIGRATION_NEW,
- 'wgActorTableSchemaMigrationStage' => SCHEMA_COMPAT_OLD,
+ 'wgActorTableSchemaMigrationStage' => SCHEMA_COMPAT_NEW,
] );
$this->overrideMwServices();
( $model === null || $model === CONTENT_MODEL_WIKITEXT )
) {
$ns = $this->getDefaultWikitextNS();
- $titleString = MWNamespace::getCanonicalName( $ns ) . ':' . $titleString;
+ $titleString = MediaWikiServices::getInstance()->getNamespaceInfo()->
+ getCanonicalName( $ns ) . ':' . $titleString;
}
$title = Title::newFromText( $titleString );
);
}
- /**
- * @covers Revision::fetchRevision
- */
- public function testFetchRevision() {
- // Hidden process cache assertion below
- $this->testPage->getRevision()->getId();
-
- $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
- $id = $this->testPage->getRevision()->getId();
-
- $this->hideDeprecated( 'Revision::fetchRevision' );
- $res = Revision::fetchRevision( $this->testPage->getTitle() );
-
- # note: order is unspecified
- $rows = [];
- while ( ( $row = $res->fetchObject() ) ) {
- $rows[$row->rev_id] = $row;
- }
-
- $this->assertEmpty( $rows, 'expected empty set' );
- }
-
/**
* @covers Revision::getPage
*/
$this->assertEquals( $latestRevision, $newRevision->getPrevious()->getId() );
}
+ /**
+ * @covers Title::getPreviousRevisionID
+ * @covers Title::getRelativeRevisionID
+ * @covers MediaWiki\Revision\RevisionStore::getPreviousRevision
+ * @covers MediaWiki\Revision\RevisionStore::getRelativeRevision
+ */
+ public function testTitleGetPreviousRevisionID() {
+ $oldestId = $this->testPage->getOldestRevision()->getId();
+ $latestId = $this->testPage->getLatest();
+
+ $title = $this->testPage->getTitle();
+
+ $this->assertFalse( $title->getPreviousRevisionID( $oldestId ) );
+
+ $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
+ $newId = $this->testPage->getRevision()->getId();
+
+ $this->assertEquals( $latestId, $title->getPreviousRevisionID( $newId ) );
+ }
+
+ /**
+ * @covers Title::getPreviousRevisionID
+ * @covers Title::getRelativeRevisionID
+ */
+ public function testTitleGetPreviousRevisionID_invalid() {
+ $this->assertFalse( $this->testPage->getTitle()->getPreviousRevisionID( 123456789 ) );
+ }
+
/**
* @covers Revision::getNext
*/
$this->assertEquals( $rev2->getId(), $rev1->getNext()->getId() );
}
+ /**
+ * @covers Title::getNextRevisionID
+ * @covers Title::getRelativeRevisionID
+ * @covers MediaWiki\Revision\RevisionStore::getNextRevision
+ * @covers MediaWiki\Revision\RevisionStore::getRelativeRevision
+ */
+ public function testTitleGetNextRevisionID() {
+ $title = $this->testPage->getTitle();
+
+ $origId = $this->testPage->getLatest();
+
+ $this->assertFalse( $title->getNextRevisionID( $origId ) );
+
+ $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
+ $newId = $this->testPage->getLatest();
+
+ $this->assertSame( $this->testPage->getLatest(), $title->getNextRevisionID( $origId ) );
+ }
+
+ /**
+ * @covers Title::getNextRevisionID
+ * @covers Title::getRelativeRevisionID
+ */
+ public function testTitleGetNextRevisionID_invalid() {
+ $this->assertFalse( $this->testPage->getTitle()->getNextRevisionID( 123456789 ) );
+ }
+
/**
* @covers Revision::newNullRevision
*/
'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() );
}
/**
);
$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() );
$this->setService( 'MainWANObjectCache', $cache );
$db = wfGetDB( DB_MASTER );
+ $now = 1553893742;
+ $cache->setMockTime( $now );
+
// Get a fresh revision to use during testing
$this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
$rev = $this->testPage->getRevision();
$cache->delete( $key, WANObjectCache::HOLDOFF_NONE );
$this->assertFalse( $cache->get( $key ) );
+ ++$now;
+
// Get the new revision and make sure it is in the cache and correct
$newRev = Revision::newKnownCurrent( $db, $rev->getPage(), $rev->getId() );
$this->assertRevEquals( $rev, $newRev );
$this->assertSame( $expected, $rev->getTextId() );
}
- public function provideGetRevisionText() {
- yield [
- [ 'text' ]
- ];
- }
+ abstract public function provideGetRevisionText();
/**
* @dataProvider provideGetRevisionText