rdbms: Rename "memCache" to "memStash" in LBFactory
[mediawiki.git] / tests / phpunit / includes / parser / ParserPreloadTest.php
blob77073955bd2bfe67e633f2321f4a6a6538179878
1 <?php
2 /**
3 * Basic tests for Parser::getPreloadText
4 * @author Antoine Musso
6 * @covers Parser
7 * @covers StripState
9 * @covers Preprocessor_DOM
10 * @covers PPDStack
11 * @covers PPDStackElement
12 * @covers PPDPart
13 * @covers PPFrame_DOM
14 * @covers PPTemplateFrame_DOM
15 * @covers PPCustomFrame_DOM
16 * @covers PPNode_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 {
31 /**
32 * @var Parser
34 private $testParser;
35 /**
36 * @var ParserOptions
38 private $testParserOptions;
39 /**
40 * @var Title
42 private $title;
44 protected function setUp() {
45 global $wgContLang;
47 parent::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() {
58 parent::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 = '' ) {
85 $this->assertEquals(
86 $expected,
87 $this->testParser->getPreloadText(
88 $text,
89 $this->title,
90 $this->testParserOptions
92 $msg