+ public function testGetRevisionParserOutput_incompleteNoId() {
+ $title = $this->getMockTitle( 7, 21 );
+
+ $rev = new MutableRevisionRecord( $title );
+
+ $text = "";
+ $text .= "* page:{{PAGENAME}}!\n";
+ $text .= "* rev:{{REVISIONID}}!\n";
+ $text .= "* user:{{REVISIONUSER}}!\n";
+ $text .= "* time:{{REVISIONTIMESTAMP}}!\n";
+
+ $rev->setContent( 'main', new WikitextContent( $text ) );
+
+ $options = ParserOptions::newCanonical( 'canonical' );
+ $rr = new RenderedRevision( $title, $rev, $options, $this->combinerCallback );
+
+ // MutableRevisionRecord without ID should be used by the parser.
+ // USeful for fake
+ $html = $rr->getRevisionParserOutput()->getText();
+
+ $this->assertContains( 'page:RenderTestPage!', $html );
+ $this->assertContains( 'rev:!', $html );
+ $this->assertContains( 'user:!', $html );
+ $this->assertContains( 'time:!', $html );
+ }
+
+ public function testGetRevisionParserOutput_incompleteWithId() {
+ $title = $this->getMockTitle( 7, 21 );
+
+ $rev = new MutableRevisionRecord( $title );
+ $rev->setId( 21 );
+
+ $text = "";
+ $text .= "* page:{{PAGENAME}}!\n";
+ $text .= "* rev:{{REVISIONID}}!\n";
+ $text .= "* user:{{REVISIONUSER}}!\n";
+ $text .= "* time:{{REVISIONTIMESTAMP}}!\n";
+
+ $rev->setContent( 'main', new WikitextContent( $text ) );
+
+ $actualRevision = $this->getMockRevision(
+ RevisionStoreRecord::class,
+ $title,
+ 21,
+ RevisionRecord::DELETED_TEXT
+ );
+
+ $options = ParserOptions::newCanonical( 'canonical' );
+ $rr = new RenderedRevision( $title, $rev, $options, $this->combinerCallback );
+
+ // MutableRevisionRecord with ID should not be used by the parser,
+ // revision should be loaded instead!
+ $revisionStore = $this->getMockBuilder( RevisionStore::class )
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $revisionStore->expects( $this->once() )
+ ->method( 'getKnownCurrentRevision' )
+ ->with( $title, 0 )
+ ->willReturn( $actualRevision );
+
+ $this->setService( 'RevisionStore', $revisionStore );
+
+ $html = $rr->getRevisionParserOutput()->getText();
+
+ $this->assertContains( 'page:RenderTestPage!', $html );
+ $this->assertContains( 'rev:21!', $html );
+ $this->assertContains( 'user:Frank!', $html );
+ $this->assertContains( 'time:20180101000003!', $html );
+ }
+