An alternative to using DOMDocument for normalizing when using Preprocessor_Hash.
authorPlatonides <platonides@users.mediawiki.org>
Fri, 28 Oct 2011 15:13:27 +0000 (15:13 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Fri, 28 Oct 2011 15:13:27 +0000 (15:13 +0000)
Follow-up r99909.

tests/phpunit/includes/parser/PreprocessorTest.php

index e8c0c0e..033651d 100644 (file)
@@ -131,6 +131,8 @@ class PreprocessorTest extends MediaWikiTestCase {
         * @return string
         */
        function normalizeXml( $xml ) {
+               return preg_replace( '!<([a-z]+)/>!', '<$1></$1>', str_replace( ' />', '/>', $xml ) );
+               
                $dom = new DOMDocument();
                // 1 << 19 == XML_PARSE_HUGE, needed so newer versions of libxml2 don't barf when the XML is >256 levels deep
                $dom->loadXML( $xml, 1 << 19 );