MediaWiki  1.23.12
ParserPreloadTest.php
Go to the documentation of this file.
1 <?php
10  private $testParser;
14  private $testParserOptions;
18  private $title;
19 
20  protected function setUp() {
22 
23  parent::setUp();
24  $this->testParserOptions = ParserOptions::newFromUserAndLang( new User, $wgContLang );
25 
26  $this->testParser = new Parser();
27  $this->testParser->Options( $this->testParserOptions );
28  $this->testParser->clearState();
29 
30  $this->title = Title::newFromText( 'Preload Test' );
31  }
32 
33  protected function tearDown() {
34  parent::tearDown();
35 
36  unset( $this->testParser );
37  unset( $this->title );
38  }
39 
43  public function testPreloadSimpleText() {
44  $this->assertPreloaded( 'simple', 'simple' );
45  }
46 
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)'
55  );
56  }
57 
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)'
66  );
67  }
68 
69  protected function assertPreloaded( $expected, $text, $msg = '' ) {
70  $this->assertEquals(
71  $expected,
72  $this->testParser->getPreloadText(
73  $text,
74  $this->title,
75  $this->testParserOptions
76  ),
77  $msg
78  );
79  }
80 }
ParserOptions
Set options of the Parser.
Definition: ParserOptions.php:31
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ParserPreloadTest\tearDown
tearDown()
Definition: ParserPreloadTest.php:30
ParserPreloadTest\testPreloadedNowikiIsUnstripped
testPreloadedNowikiIsUnstripped()
@covers Parser::getPreloadText
Definition: ParserPreloadTest.php:58
$wgContLang
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 content language as $wgContLang
Definition: design.txt:56
title
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Definition: All_system_messages.txt:2703
ParserPreloadTest\setUp
setUp()
Definition: ParserPreloadTest.php:17
ParserPreloadTest\$testParserOptions
ParserOptions $testParserOptions
Definition: ParserPreloadTest.php:12
ParserOptions\newFromUserAndLang
static newFromUserAndLang(User $user, Language $lang)
Get a ParserOptions object from a given user and language.
Definition: ParserOptions.php:386
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ParserPreloadTest\assertPreloaded
assertPreloaded( $expected, $text, $msg='')
Definition: ParserPreloadTest.php:66
ParserPreloadTest
Basic tests for Parser::getPreloadText.
Definition: ParserPreloadTest.php:6
ParserPreloadTest\testPreloadedPreIsUnstripped
testPreloadedPreIsUnstripped()
@covers Parser::getPreloadText
Definition: ParserPreloadTest.php:47
ParserPreloadTest\$testParser
Parser $testParser
Definition: ParserPreloadTest.php:9
Title
Represents a title within MediaWiki.
Definition: Title.php:35
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:59
ParserPreloadTest\$title
Title $title
Definition: ParserPreloadTest.php:15
ParserPreloadTest\testPreloadSimpleText
testPreloadSimpleText()
@covers Parser::getPreloadText
Definition: ParserPreloadTest.php:40