r100599 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100598‎ | r100599 | r100600 >
Date:10:51, 24 October 2011
Author:hashar
Status:ok
Tags:
Comment:
test that preloaded text is unstripped

bug 27467 reported our preloaded system did not unstrip <nowiki>
or <pre> enclosed text. The fix was applied by r82473.
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/parser/ParserPreloadTest.php (added) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/parser/ParserPreloadTest.php
@@ -0,0 +1,67 @@
 2+<?php
 3+/**
 4+ * Basic tests for Parser::getPreloadText
 5+ * @author Antoine Musso
 6+ */
 7+class ParserPreloadTest extends MediaWikiTestCase {
 8+ private $testParser;
 9+ private $testParserOptions;
 10+ private $title;
 11+
 12+ function setUp() {
 13+ $this->testParserOptions = new ParserOptions();
 14+
 15+ $this->testParser = new Parser();
 16+ $this->testParser->Options( $this->testParserOptions );
 17+ $this->testParser->clearState();
 18+
 19+ $this->title = Title::newFromText( 'Preload Test' );
 20+ }
 21+
 22+ function tearDown() {
 23+ unset( $this->testParser );
 24+ unset( $this->title );
 25+ }
 26+
 27+ /**
 28+ * @covers Parser::getPreloadText
 29+ */
 30+ function testPreloadSimpleText() {
 31+ $this->assertPreloaded( 'simple', 'simple' );
 32+ }
 33+
 34+ /**
 35+ * @covers Parser::getPreloadText
 36+ */
 37+ function testPreloadedPreIsUnstripped() {
 38+ $this->assertPreloaded(
 39+ '<pre>monospaced</pre>',
 40+ '<pre>monospaced</pre>',
 41+ '<pre> in preloaded text must be unstripped (bug 27467)'
 42+ );
 43+ }
 44+
 45+ /**
 46+ * @covers Parser::getPreloadText
 47+ */
 48+ function testPreloadedNowikiIsUnstripped() {
 49+ $this->assertPreloaded(
 50+ '<nowiki>[[Dummy title]]</nowiki>',
 51+ '<nowiki>[[Dummy title]]</nowiki>',
 52+ '<nowiki> in preloaded text must be unstripped (bug 27467)'
 53+ );
 54+ }
 55+
 56+ function assertPreloaded( $expected, $text, $msg='') {
 57+ $this->assertEquals(
 58+ $expected,
 59+ $this->testParser->getPreloadText(
 60+ $text,
 61+ $this->title,
 62+ $this->testParserOptions
 63+ ),
 64+ $msg
 65+ );
 66+ }
 67+
 68+}
Property changes on: trunk/phase3/tests/phpunit/includes/parser/ParserPreloadTest.php
___________________________________________________________________
Added: svn:eol-style
169 + native

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82473(Bug #27467) preload can leave UNIQ...mah19:18, 19 February 2011

Status & tagging log