registration: Add support for $wgParserTestFiles
authorKunal Mehta <legoktm@gmail.com>
Sun, 3 May 2015 06:02:22 +0000 (23:02 -0700)
committerKunal Mehta <legoktm@gmail.com>
Sun, 3 May 2015 06:16:54 +0000 (23:16 -0700)
Bug: T97921
Change-Id: I9a736a4c0ff739c4acf742b8f17792544851b28e

docs/extension.schema.json
includes/registration/ExtensionProcessor.php
maintenance/convertExtensionToRegistration.php

index b52369f..8e8b23b 100644 (file)
                "config": {
                        "type": "object",
                        "description": "Configuration options for this extension"
+               },
+               "ParserTestFiles": {
+                       "type": "array",
+                       "description": "Parser test suite files to be run by parserTests.php when no specific filename is passed to it"
                }
        }
 }
index 561e798..4b9a754 100644 (file)
@@ -24,7 +24,6 @@ class ExtensionProcessor implements Processor {
                'ContentHandlers',
                'ConfigRegistry',
                'RateLimits',
-               'ParserTestFiles',
                'RecentChangesFlags',
                'MediaHandlers',
                'ExtensionFunctions',
@@ -123,6 +122,7 @@ class ExtensionProcessor implements Processor {
                $this->extractMessagesDirs( $dir, $info );
                $this->extractNamespaces( $info );
                $this->extractResourceLoaderModules( $dir, $info );
+               $this->extractParserTestFiles( $dir, $info );
                if ( isset( $info['callback'] ) ) {
                        $this->callbacks[] = $info['callback'];
                        $this->processed[] = 'callback';
@@ -270,6 +270,15 @@ class ExtensionProcessor implements Processor {
                }
        }
 
+       protected function extractParserTestFiles( $dir, array $info ) {
+               if ( isset( $info['ParserTestFiles'] ) ) {
+                       foreach ( $info['ParserTestFiles'] as $path ) {
+                               $this->globals['wgParserTestFiles'][] = "$dir/$path";
+                       }
+                       $this->processed[] = 'ParserTestFiles';
+               }
+       }
+
        /**
         * @param string $name
         * @param mixed $value
index 78b4e8c..06370e9 100644 (file)
@@ -13,6 +13,7 @@ class ConvertExtensionToRegistration extends Maintenance {
                'ResourceModuleSkinStyles' => 'handleResourceModules',
                'Hooks' => 'handleHooks',
                'ExtensionFunctions' => 'handleExtensionFunctions',
+               'ParserTestFiles' => 'removeAbsolutePath',
        );
 
        /**