From 9441dde8bfb95277df073717ed7817dced40f948 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 28 Mar 2014 05:41:12 +0100 Subject: Update to MediaWiki 1.22.5 --- .../phpunit/includes/parser/ParserPreloadTest.php | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 tests/phpunit/includes/parser/ParserPreloadTest.php (limited to 'tests/phpunit/includes/parser/ParserPreloadTest.php') diff --git a/tests/phpunit/includes/parser/ParserPreloadTest.php b/tests/phpunit/includes/parser/ParserPreloadTest.php new file mode 100644 index 00000000..d12fee36 --- /dev/null +++ b/tests/phpunit/includes/parser/ParserPreloadTest.php @@ -0,0 +1,80 @@ +testParserOptions = ParserOptions::newFromUserAndLang( new User, $wgContLang ); + + $this->testParser = new Parser(); + $this->testParser->Options( $this->testParserOptions ); + $this->testParser->clearState(); + + $this->title = Title::newFromText( 'Preload Test' ); + } + + protected function tearDown() { + parent::tearDown(); + + unset( $this->testParser ); + unset( $this->title ); + } + + /** + * @covers Parser::getPreloadText + */ + public function testPreloadSimpleText() { + $this->assertPreloaded( 'simple', 'simple' ); + } + + /** + * @covers Parser::getPreloadText + */ + public function testPreloadedPreIsUnstripped() { + $this->assertPreloaded( + '
monospaced
', + '
monospaced
', + '
 in preloaded text must be unstripped (bug 27467)'
+		);
+	}
+
+	/**
+	 * @covers Parser::getPreloadText
+	 */
+	public function testPreloadedNowikiIsUnstripped() {
+		$this->assertPreloaded(
+			'[[Dummy title]]',
+			'[[Dummy title]]',
+			' in preloaded text must be unstripped (bug 27467)'
+		);
+	}
+
+	protected function assertPreloaded( $expected, $text, $msg = '' ) {
+		$this->assertEquals(
+			$expected,
+			$this->testParser->getPreloadText(
+				$text,
+				$this->title,
+				$this->testParserOptions
+			),
+			$msg
+		);
+	}
+}
-- 
cgit v1.2.3-54-g00ecf