MediaWiki REL1_31
ParserPreloadTest.php
Go to the documentation of this file.
1<?php
34 private $testParser;
42 private $title;
43
44 protected function setUp() {
45 global $wgContLang;
46
47 parent::setUp();
48 $this->testParserOptions = ParserOptions::newFromUserAndLang( new User, $wgContLang );
49
50 $this->testParser = new Parser();
51 $this->testParser->Options( $this->testParserOptions );
52 $this->testParser->clearState();
53
54 $this->title = Title::newFromText( 'Preload Test' );
55 }
56
57 protected function tearDown() {
58 parent::tearDown();
59
60 unset( $this->testParser );
61 unset( $this->title );
62 }
63
64 public function testPreloadSimpleText() {
65 $this->assertPreloaded( 'simple', 'simple' );
66 }
67
68 public function testPreloadedPreIsUnstripped() {
69 $this->assertPreloaded(
70 '<pre>monospaced</pre>',
71 '<pre>monospaced</pre>',
72 '<pre> in preloaded text must be unstripped (T29467)'
73 );
74 }
75
77 $this->assertPreloaded(
78 '<nowiki>[[Dummy title]]</nowiki>',
79 '<nowiki>[[Dummy title]]</nowiki>',
80 '<nowiki> in preloaded text must be unstripped (T29467)'
81 );
82 }
83
84 protected function assertPreloaded( $expected, $text, $msg = '' ) {
85 $this->assertEquals(
86 $expected,
87 $this->testParser->getPreloadText(
88 $text,
89 $this->title,
90 $this->testParserOptions
91 ),
92 $msg
93 );
94 }
95}
Set options of the Parser.
Basic tests for Parser::getPreloadText.
ParserOptions $testParserOptions
assertPreloaded( $expected, $text, $msg='')
PHP Parser - Processes wiki markup (which uses a more user-friendly syntax, such as "[[link]]" for ma...
Definition Parser.php:70
Represents a title within MediaWiki.
Definition Title.php:39
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:53
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition design.txt:57