From: Antoine Musso Date: Mon, 24 Oct 2011 10:51:46 +0000 (+0000) Subject: test that preloaded text is unstripped X-Git-Tag: 1.31.0-rc.0~26935 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=874ae7a73147063ee8adff5a581d113cfcf79203;p=lhc%2Fweb%2Fwiklou.git test that preloaded text is unstripped bug 27467 reported our preloaded system did not unstrip or
 enclosed text. The fix was applied by r82473.
---

diff --git a/tests/phpunit/includes/parser/ParserPreloadTest.php b/tests/phpunit/includes/parser/ParserPreloadTest.php
new file mode 100644
index 0000000000..0e8ef53078
--- /dev/null
+++ b/tests/phpunit/includes/parser/ParserPreloadTest.php
@@ -0,0 +1,67 @@
+testParserOptions = new ParserOptions();
+
+		$this->testParser = new Parser();
+		$this->testParser->Options( $this->testParserOptions );
+		$this->testParser->clearState();
+
+		$this->title = Title::newFromText( 'Preload Test' );
+	}
+
+	function tearDown() {
+		unset( $this->testParser );
+		unset( $this->title );
+	}
+
+	/**
+	 * @covers Parser::getPreloadText
+	 */
+	function testPreloadSimpleText() {
+		$this->assertPreloaded( 'simple', 'simple' );
+	}
+
+	/**
+	 * @covers Parser::getPreloadText
+	 */
+	function testPreloadedPreIsUnstripped() {
+		$this->assertPreloaded(
+			'
monospaced
', + '
monospaced
', + '
 in preloaded text must be unstripped (bug 27467)'
+		);
+	}
+
+	/**
+	 * @covers Parser::getPreloadText
+	 */
+	function testPreloadedNowikiIsUnstripped() {
+		$this->assertPreloaded(
+			'[[Dummy title]]',
+			'[[Dummy title]]',
+			' in preloaded text must be unstripped (bug 27467)'
+		);
+	}
+
+	function assertPreloaded( $expected, $text, $msg='') {
+		$this->assertEquals(
+			$expected,
+			$this->testParser->getPreloadText(
+				$text,
+				$this->title,
+				$this->testParserOptions
+			),
+			$msg
+		);
+	}
+
+}