From 796549c219749cae51e8f51aa05a57f627624d13 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 19 Sep 2005 13:10:48 +0000 Subject: [PATCH] * Adding a test suite for parser hooks --- maintenance/parserTests.inc | 3 ++ maintenance/parserTests.txt | 88 +++++++++++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 3 deletions(-) diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index f7b6ba06e9..8197a768ff 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -32,6 +32,8 @@ require_once( 'commandLine.inc' ); require_once( "$IP/includes/ObjectCache.php" ); require_once( "$IP/includes/BagOStuff.php" ); require_once( "$IP/languages/LanguageUtf8.php" ); +require_once( "$IP/includes/Hooks.php" ); +require_once( "$IP/maintenance/parserTestsParserHook.php" ); /** * @package MediaWiki @@ -236,6 +238,7 @@ class ParserTest { } $parser =& new Parser(); + wfRunHooks( 'ParserTestParser', array( &$parser ) ); $title =& Title::makeTitle( NS_MAIN, $titleText ); if (preg_match('/\\bpst\\b/i', $opts)) { diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 75890ad8e3..ad1a8b0e29 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -2253,9 +2253,8 @@ Table multiple attributes correction !! result - - -
status
+ status + !!end @@ -2636,6 +2635,89 @@ Table attribute safety !! end +### +### Parser hooks +### +!! test +Parser hook: empty input +!! input + +!! result +!! end + +!! test +Parser hook: basic input +!! input +input +!! result +

input +

+!! end + +!! test +Parser hook: case insensetive +!! input +input +!! result +

input +

+!! end + +!! test +Parser hook: basic arguments +!! input + +!! result +
+Array
+(
+    [width] => 200
+    [height] => 100
+    [depth] => 50
+    [square] => square
+)
+
+ +!! end + +!! test +Parser hook: empty input using terminated empty elements (bug 2374) +!! input +text +!! result +
+Array
+(
+    [foo] => bar
+)
+
+text +!! end + +#
should be output literally since there is no matching tag that begins it +!! test +Parser hook: basic arguments using terminated empty elements (bug 2374) +!! input + +other stuff + +!! result +
+Array
+(
+    [width] => 200
+    [height] => 100
+    [depth] => 50
+    [square] => square
+)
+
+other stuff + + +!! end + + + TODO: more images -- 2.20.1