$this->assertEquals( __METHOD__, $rev->getContent()->getNativeData() );
}
+ /**
+ * @covers Revision::newNullRevision
+ */
+ public function testNewNullRevision_badPage() {
+ $dbw = wfGetDB( DB_MASTER );
+ $rev = Revision::newNullRevision( $dbw, -1, 'a null revision', false );
+
+ $this->assertNull( $rev );
+ }
+
/**
* @covers Revision::insertOn
*/
$this->assertEquals( $rev->getId(), $cachedRow->rev_id );
}
+ public function testNewKnownCurrent_withPageId() {
+ $db = wfGetDB( DB_MASTER );
+
+ $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ );
+ $rev = $this->testPage->getRevision();
+
+ $pageId = $this->testPage->getId();
+
+ $newRev = Revision::newKnownCurrent( $db, $pageId, $rev->getId() );
+ $this->assertRevEquals( $rev, $newRev );
+ }
+
+ public function testNewKnownCurrent_returnsFalseWhenTitleDoesntExist() {
+ $db = wfGetDB( DB_MASTER );
+
+ $this->assertFalse( Revision::newKnownCurrent( $db, 0 ) );
+ }
+
public function provideUserCanBitfield() {
yield [ 0, 0, [], null, true ];
// Bitfields match, user has no permissions