MediaWiki REL1_33
ParserPreloadTest.php
Go to the documentation of this file.
1<?php
2
4
37 private $testParser;
45 private $title;
46
47 protected function setUp() {
48 parent::setUp();
49 $this->testParserOptions = ParserOptions::newFromUserAndLang( new User,
50 MediaWikiServices::getInstance()->getContentLanguage() );
51
52 $this->testParser = new Parser();
53 $this->testParser->Options( $this->testParserOptions );
54 $this->testParser->clearState();
55
56 $this->title = Title::newFromText( 'Preload Test' );
57 }
58
59 protected function tearDown() {
60 parent::tearDown();
61
62 unset( $this->testParser );
63 unset( $this->title );
64 }
65
66 public function testPreloadSimpleText() {
67 $this->assertPreloaded( 'simple', 'simple' );
68 }
69
70 public function testPreloadedPreIsUnstripped() {
71 $this->assertPreloaded(
72 '<pre>monospaced</pre>',
73 '<pre>monospaced</pre>',
74 '<pre> in preloaded text must be unstripped (T29467)'
75 );
76 }
77
79 $this->assertPreloaded(
80 '<nowiki>[[Dummy title]]</nowiki>',
81 '<nowiki>[[Dummy title]]</nowiki>',
82 '<nowiki> in preloaded text must be unstripped (T29467)'
83 );
84 }
85
86 protected function assertPreloaded( $expected, $text, $msg = '' ) {
87 $this->assertEquals(
88 $expected,
89 $this->testParser->getPreloadText(
90 $text,
91 $this->title,
92 $this->testParserOptions
93 ),
94 $msg
95 );
96 }
97}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
MediaWikiServices is the service locator for the application scope of MediaWiki.
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:69
Represents a title within MediaWiki.
Definition Title.php:40
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition User.php:48
title