3 * Basic tests for Parser::getPreloadText
4 * @author Antoine Musso
6 class ParserPreloadTest
extends MediaWikiTestCase
{
8 private $testParserOptions;
11 protected function setUp() {
12 $this->testParserOptions
= new ParserOptions();
14 $this->testParser
= new Parser();
15 $this->testParser
->Options( $this->testParserOptions
);
16 $this->testParser
->clearState();
18 $this->title
= Title
::newFromText( 'Preload Test' );
21 protected function tearDown() {
22 unset( $this->testParser
);
23 unset( $this->title
);
27 * @covers Parser::getPreloadText
29 function testPreloadSimpleText() {
30 $this->assertPreloaded( 'simple', 'simple' );
34 * @covers Parser::getPreloadText
36 function testPreloadedPreIsUnstripped() {
37 $this->assertPreloaded(
38 '<pre>monospaced</pre>',
39 '<pre>monospaced</pre>',
40 '<pre> in preloaded text must be unstripped (bug 27467)'
45 * @covers Parser::getPreloadText
47 function testPreloadedNowikiIsUnstripped() {
48 $this->assertPreloaded(
49 '<nowiki>[[Dummy title]]</nowiki>',
50 '<nowiki>[[Dummy title]]</nowiki>',
51 '<nowiki> in preloaded text must be unstripped (bug 27467)'
55 function assertPreloaded( $expected, $text, $msg='') {
58 $this->testParser
->getPreloadText(
61 $this->testParserOptions