parser: Add unit tests for parser output flags ('showflags' option)
[lhc/web/wiklou.git] / tests / parser / ParserTestRunner.php
index 77717f0..9dce73f 100644 (file)
@@ -778,6 +778,7 @@ class ParserTestRunner {
 
                if ( isset( $opts['pst'] ) ) {
                        $out = $parser->preSaveTransform( $test['input'], $title, $user, $options );
+                       $output = $parser->getOutput();
                } elseif ( isset( $opts['msg'] ) ) {
                        $out = $parser->transformMsg( $test['input'], $options, $title );
                } elseif ( isset( $opts['section'] ) ) {
@@ -828,6 +829,12 @@ class ParserTestRunner {
                        }
                }
 
+               if ( isset( $output ) && isset( $opts['showflags'] ) ) {
+                       $actualFlags = array_keys( TestingAccessWrapper::newFromObject( $output )->mFlags );
+                       sort( $actualFlags );
+                       $out .= "\nflags=" . join( ', ', $actualFlags );
+               }
+
                ScopedCallback::consume( $teardownGuard );
 
                $expected = $test['result'];