} elseif ( $isCurrent ) {
#XXX: why use RAW audience here, and PUBLIC (default) below?
$content = $this->page->getContent( Revision::RAW );
- if ( $content === null ) {
- return false;
- }
-
} else {
$rev = Revision::newFromTitle( $this->page->getTitle(), $this->revid );
+
if ( $rev === null ) {
- return false;
+ $content = null;
+ } else {
+ #XXX: why use PUBLIC audience here (default), and RAW above?
+ $content = $rev->getContent();
}
+ }
- #XXX: why use PUBLIC audience here (default), and RAW above?
- $content = $rev->getContent();
+ if ( $content === null ) {
+ return false;
}
$time = - microtime( true );
return $po;
}
- /**
- * @dataProvider provideGetParserOutput
- */
public function testGetParserOutput_nonexisting( ) {
static $count = 0;
$count ++;
- $page = new WikiPage( new Title( "testGetParserOutput_nonexisting_$count" ) );
+ $page = new WikiPage( new Title( "WikiPageTest_testGetParserOutput_nonexisting_$count" ) );
$opt = new ParserOptions();
$po = $page->getParserOutput( $opt );
$this->assertFalse( $po, "getParserOutput() shall return false for non-existing pages." );
}
+ public function testGetParserOutput_badrev( ) {
+ $page = $this->createPage( 'WikiPageTest_testGetParserOutput', "dummy", CONTENT_MODEL_WIKITEXT );
+
+ $opt = new ParserOptions();
+ $po = $page->getParserOutput( $opt, $page->getLatest() + 1234 );
+
+ //@todo: would be neat to also test deleted revision
+
+ $this->assertFalse( $po, "getParserOutput() shall return false for non-existing revisions." );
+ }
+
static $sections =
"Intro