3 * Basic tests for Parser::getPreloadText
4 * @author Antoine Musso
6 class ParserPreloadTest
extends MediaWikiTestCase
{
8 private $testParserOptions;
11 protected function setUp() {
14 $this->testParserOptions
= new ParserOptions();
16 $this->testParser
= new Parser();
17 $this->testParser
->Options( $this->testParserOptions
);
18 $this->testParser
->clearState();
20 $this->title
= Title
::newFromText( 'Preload Test' );
23 protected function tearDown() {
26 unset( $this->testParser
);
27 unset( $this->title
);
31 * @covers Parser::getPreloadText
33 function testPreloadSimpleText() {
34 $this->assertPreloaded( 'simple', 'simple' );
38 * @covers Parser::getPreloadText
40 function testPreloadedPreIsUnstripped() {
41 $this->assertPreloaded(
42 '<pre>monospaced</pre>',
43 '<pre>monospaced</pre>',
44 '<pre> in preloaded text must be unstripped (bug 27467)'
49 * @covers Parser::getPreloadText
51 function testPreloadedNowikiIsUnstripped() {
52 $this->assertPreloaded(
53 '<nowiki>[[Dummy title]]</nowiki>',
54 '<nowiki>[[Dummy title]]</nowiki>',
55 '<nowiki> in preloaded text must be unstripped (bug 27467)'
59 function assertPreloaded( $expected, $text, $msg='') {
62 $this->testParser
->getPreloadText(
65 $this->testParserOptions