3 * Basic tests for Parser::getPreloadText
4 * @author Antoine Musso
6 class ParserPreloadTest
extends MediaWikiTestCase
{
8 private $testParserOptions;
11 protected function setUp() {
15 $this->testParserOptions
= ParserOptions
::newFromUserAndLang( new User
, $wgContLang );
17 $this->testParser
= new Parser();
18 $this->testParser
->Options( $this->testParserOptions
);
19 $this->testParser
->clearState();
21 $this->title
= Title
::newFromText( 'Preload Test' );
24 protected function tearDown() {
27 unset( $this->testParser
);
28 unset( $this->title
);
32 * @covers Parser::getPreloadText
34 function testPreloadSimpleText() {
35 $this->assertPreloaded( 'simple', 'simple' );
39 * @covers Parser::getPreloadText
41 function testPreloadedPreIsUnstripped() {
42 $this->assertPreloaded(
43 '<pre>monospaced</pre>',
44 '<pre>monospaced</pre>',
45 '<pre> in preloaded text must be unstripped (bug 27467)'
50 * @covers Parser::getPreloadText
52 function testPreloadedNowikiIsUnstripped() {
53 $this->assertPreloaded(
54 '<nowiki>[[Dummy title]]</nowiki>',
55 '<nowiki>[[Dummy title]]</nowiki>',
56 '<nowiki> in preloaded text must be unstripped (bug 27467)'
60 function assertPreloaded( $expected, $text, $msg = '' ) {
63 $this->testParser
->getPreloadText(
66 $this->testParserOptions