Merge "rdbms: upgrade transaction misuse warnings to exceptions"
[lhc/web/wiklou.git] / tests / parser / ParserTestRunner.php
index d4b1f91..f0c815f 100644 (file)
@@ -636,7 +636,6 @@ class ParserTestRunner {
 
        /**
         * Remove last character if it is a newline
-        * @group utility
         * @param string $s
         * @return string
         */
@@ -831,6 +830,19 @@ class ParserTestRunner {
                $parser = $this->getParser( $preprocessor );
                $title = Title::newFromText( $titleText );
 
+               if ( isset( $opts['styletag'] ) ) {
+                       // For testing the behavior of <style> (including those deduplicated
+                       // into <link> tags), add tag hooks to allow them to be generated.
+                       $parser->setHook( 'style', function ( $content, $attributes, $parser ) {
+                               $marker = Parser::MARKER_PREFIX . '-style-' . md5( $content ) . Parser::MARKER_SUFFIX;
+                               $parser->mStripState->addNoWiki( $marker, $content );
+                               return Html::inlineStyle( $marker, 'all', $attributes );
+                       } );
+                       $parser->setHook( 'link', function ( $content, $attributes, $parser ) {
+                               return Html::element( 'link', $attributes );
+                       } );
+               }
+
                if ( isset( $opts['pst'] ) ) {
                        $out = $parser->preSaveTransform( $test['input'], $title, $user, $options );
                        $output = $parser->getOutput();