3 * Basic tests for Parser::getPreloadText
4 * @author Antoine Musso
9 * @covers Preprocessor_DOM
11 * @covers PPDStackElement
14 * @covers PPTemplateFrame_DOM
15 * @covers PPCustomFrame_DOM
18 * @covers Preprocessor_Hash
19 * @covers PPDStack_Hash
20 * @covers PPDStackElement_Hash
21 * @covers PPDPart_Hash
22 * @covers PPFrame_Hash
23 * @covers PPTemplateFrame_Hash
24 * @covers PPCustomFrame_Hash
25 * @covers PPNode_Hash_Tree
26 * @covers PPNode_Hash_Text
27 * @covers PPNode_Hash_Array
28 * @covers PPNode_Hash_Attr
30 class ParserPreloadTest
extends MediaWikiTestCase
{
38 private $testParserOptions;
44 protected function setUp() {
48 $this->testParserOptions
= ParserOptions
::newFromUserAndLang( new User
, $wgContLang );
50 $this->testParser
= new Parser();
51 $this->testParser
->Options( $this->testParserOptions
);
52 $this->testParser
->clearState();
54 $this->title
= Title
::newFromText( 'Preload Test' );
57 protected function tearDown() {
60 unset( $this->testParser
);
61 unset( $this->title
);
64 public function testPreloadSimpleText() {
65 $this->assertPreloaded( 'simple', 'simple' );
68 public function testPreloadedPreIsUnstripped() {
69 $this->assertPreloaded(
70 '<pre>monospaced</pre>',
71 '<pre>monospaced</pre>',
72 '<pre> in preloaded text must be unstripped (T29467)'
76 public function testPreloadedNowikiIsUnstripped() {
77 $this->assertPreloaded(
78 '<nowiki>[[Dummy title]]</nowiki>',
79 '<nowiki>[[Dummy title]]</nowiki>',
80 '<nowiki> in preloaded text must be unstripped (T29467)'
84 protected function assertPreloaded( $expected, $text, $msg = '' ) {
87 $this->testParser
->getPreloadText(
90 $this->testParserOptions