$this->assertRevEquals( $orig, $rev );
}
+ public function provideTrueFalse() {
+ yield [ true ];
+ yield [ false ];
+ }
+
/**
+ * @dataProvider provideTrueFalse
* @covers Revision::newFromArchiveRow
*/
- public function testNewFromArchiveRow() {
+ public function testNewFromArchiveRow( $contentHandlerUseDB ) {
+ $this->setMwGlobals( 'wgContentHandlerUseDB', $contentHandlerUseDB );
+
$page = $this->createPage(
'RevisionStorageTest_testNewFromArchiveRow',
'Lorem Ipsum',
$this->assertRevEquals( $orig, $rev );
}
+ /**
+ * @covers Revision::newFromPageId
+ */
+ public function testNewFromPageId() {
+ $rev = Revision::newFromPageId( $this->testPage->getId() );
+ $this->assertRevEquals(
+ $this->testPage->getRevision(),
+ $rev
+ );
+ }
+
+ /**
+ * @covers Revision::newFromPageId
+ */
+ public function testNewFromPageIdWithLatestId() {
+ $rev = Revision::newFromPageId(
+ $this->testPage->getId(),
+ $this->testPage->getLatest()
+ );
+ $this->assertRevEquals(
+ $this->testPage->getRevision(),
+ $rev
+ );
+ }
+
+ /**
+ * @covers Revision::newFromPageId
+ */
+ public function testNewFromPageIdWithNotLatestId() {
+ $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
+ $rev = Revision::newFromPageId(
+ $this->testPage->getId(),
+ $this->testPage->getRevision()->getPrevious()->getId()
+ );
+ $this->assertRevEquals(
+ $this->testPage->getRevision()->getPrevious(),
+ $rev
+ );
+ }
+
/**
* @covers Revision::fetchRevision
*/
$this->assertSame( $content, $content2 );
}
+ /**
+ * @covers Revision::loadFromId
+ */
+ public function testLoadFromId() {
+ $rev = $this->testPage->getRevision();
+ $this->assertRevEquals(
+ $rev,
+ Revision::loadFromId( wfGetDB( DB_MASTER ), $rev->getId() )
+ );
+ }
+
+ /**
+ * @covers Revision::loadFromPageId
+ */
+ public function testLoadFromPageId() {
+ $this->assertRevEquals(
+ $this->testPage->getRevision(),
+ Revision::loadFromPageId( wfGetDB( DB_MASTER ), $this->testPage->getId() )
+ );
+ }
+
+ /**
+ * @covers Revision::loadFromPageId
+ */
+ public function testLoadFromPageIdWithLatestRevId() {
+ $this->assertRevEquals(
+ $this->testPage->getRevision(),
+ Revision::loadFromPageId(
+ wfGetDB( DB_MASTER ),
+ $this->testPage->getId(),
+ $this->testPage->getLatest()
+ )
+ );
+ }
+
+ /**
+ * @covers Revision::loadFromPageId
+ */
+ public function testLoadFromPageIdWithNotLatestRevId() {
+ $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
+ $this->assertRevEquals(
+ $this->testPage->getRevision()->getPrevious(),
+ Revision::loadFromPageId(
+ wfGetDB( DB_MASTER ),
+ $this->testPage->getId(),
+ $this->testPage->getRevision()->getPrevious()->getId()
+ )
+ );
+ }
+
}