* Adding a test suite for parser hooks
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Mon, 19 Sep 2005 13:10:48 +0000 (13:10 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Mon, 19 Sep 2005 13:10:48 +0000 (13:10 +0000)
maintenance/parserTests.inc
maintenance/parserTests.txt

index f7b6ba0..8197a76 100644 (file)
@@ -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)) {
index 75890ad..ad1a8b0 100644 (file)
@@ -2253,9 +2253,8 @@ Table multiple attributes correction
 !! result
 <table>
 <tr>
-<th class="awesome">status</th>
-</tr>
-</table>
+<th class="awesome"> status
+</th></tr></table>
 
 !!end
 
@@ -2636,6 +2635,89 @@ Table attribute safety
 
 !! end
 
+###
+### Parser hooks
+###
+!! test
+Parser hook: empty input
+!! input
+<tag></tag>
+!! result
+!! end
+
+!! test
+Parser hook: basic input
+!! input
+<tag>input</tag>
+!! result
+<p>input
+</p>
+!! end
+
+!! test
+Parser hook: case insensetive
+!! input
+<TaG>input</TAg>
+!! result
+<p>input
+</p>
+!! end
+
+!! test
+Parser hook: basic arguments
+!! input
+<tag width=200 height = "100" depth = '50' square></tag>
+!! result
+<pre>
+Array
+(
+    [width] => 200
+    [height] => 100
+    [depth] => 50
+    [square] => square
+)
+</pre>
+
+!! end
+
+!! test
+Parser hook: empty input using terminated empty elements (bug 2374)
+!! input
+<tag foo=bar/>text
+!! result
+<pre>
+Array
+(
+    [foo] => bar
+)
+</pre>
+text
+!! end
+
+# </tag> 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
+<tag width=200 height = "100" depth = '50' square/>
+other stuff
+</tag>
+!! result
+<pre>
+Array
+(
+    [width] => 200
+    [height] => 100
+    [depth] => 50
+    [square] => square
+)
+</pre>
+other stuff
+</tag>
+
+!! end
+
+
+
 
 TODO:
 more images