testParserOptions = ParserOptions::newFromUserAndLang( new User, $wgContLang ); $this->testParser = new Parser(); $this->testParser->Options( $this->testParserOptions ); $this->testParser->clearState(); $this->title = Title::newFromText( 'Preload Test' ); } protected function tearDown() { parent::tearDown(); unset( $this->testParser ); unset( $this->title ); } /** * @covers Parser::getPreloadText */ public function testPreloadSimpleText() { $this->assertPreloaded( 'simple', 'simple' ); } /** * @covers Parser::getPreloadText */ public function testPreloadedPreIsUnstripped() { $this->assertPreloaded( '
monospaced', '
monospaced', '
in preloaded text must be unstripped (bug 27467)'
);
}
/**
* @covers Parser::getPreloadText
*/
public function testPreloadedNowikiIsUnstripped() {
$this->assertPreloaded(
'[[Dummy title]] ',
'[[Dummy title]] ',
' in preloaded text must be unstripped (bug 27467)'
);
}
protected function assertPreloaded( $expected, $text, $msg = '' ) {
$this->assertEquals(
$expected,
$this->testParser->getPreloadText(
$text,
$this->title,
$this->testParserOptions
),
$msg
);
}
}