3 * Basic tests for Parser::getPreloadText
4 * @author Antoine Musso
6 class ParserPreloadTest
extends MediaWikiTestCase
{
14 private $testParserOptions;
20 protected function setUp() {
24 $this->testParserOptions
= ParserOptions
::newFromUserAndLang( new User
, $wgContLang );
26 $this->testParser
= new Parser();
27 $this->testParser
->Options( $this->testParserOptions
);
28 $this->testParser
->clearState();
30 $this->title
= Title
::newFromText( 'Preload Test' );
33 protected function tearDown() {
36 unset( $this->testParser
);
37 unset( $this->title
);
41 * @covers Parser::getPreloadText
43 public function testPreloadSimpleText() {
44 $this->assertPreloaded( 'simple', 'simple' );
48 * @covers Parser::getPreloadText
50 public function testPreloadedPreIsUnstripped() {
51 $this->assertPreloaded(
52 '<pre>monospaced</pre>',
53 '<pre>monospaced</pre>',
54 '<pre> in preloaded text must be unstripped (bug 27467)'
59 * @covers Parser::getPreloadText
61 public function testPreloadedNowikiIsUnstripped() {
62 $this->assertPreloaded(
63 '<nowiki>[[Dummy title]]</nowiki>',
64 '<nowiki>[[Dummy title]]</nowiki>',
65 '<nowiki> in preloaded text must be unstripped (bug 27467)'
69 protected function assertPreloaded( $expected, $text, $msg = '' ) {
72 $this->testParser
->getPreloadText(
75 $this->testParserOptions