From: Umherirrender Date: Fri, 13 Apr 2018 18:44:59 +0000 (+0200) Subject: Filter autodiscovered parser tests in ConvertExtensionToRegistration X-Git-Tag: 1.34.0-rc.0~5600^2 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user%27%2C%20userid=session.user.id%29%20%7D%7D?a=commitdiff_plain;h=a81cf72d63b3ace35650bb350b3822883b47cf33;p=lhc%2Fweb%2Fwiklou.git Filter autodiscovered parser tests in ConvertExtensionToRegistration Since MediaWiki 1.30 files under tests/parser/ automatically included into the parser test run when using extension registry. When migrate an extension to extension.json do not include the file when it is autodiscovered. Bug: T170037 Change-Id: I57f49610a47f0e62a1512e3769c6dbb0d845d6fb --- diff --git a/maintenance/convertExtensionToRegistration.php b/maintenance/convertExtensionToRegistration.php index 4ae9558703..6c1edc2ba0 100644 --- a/maintenance/convertExtensionToRegistration.php +++ b/maintenance/convertExtensionToRegistration.php @@ -13,7 +13,7 @@ class ConvertExtensionToRegistration extends Maintenance { 'ResourceModuleSkinStyles' => 'handleResourceModules', 'Hooks' => 'handleHooks', 'ExtensionFunctions' => 'handleExtensionFunctions', - 'ParserTestFiles' => 'removeAbsolutePath', + 'ParserTestFiles' => 'removeAutodiscoveredParserTestFiles', ]; /** @@ -222,6 +222,22 @@ class ConvertExtensionToRegistration extends Maintenance { $this->json[$realName] = $out; } + protected function removeAutodiscoveredParserTestFiles( $realName, $value ) { + $out = []; + foreach ( $value as $key => $val ) { + $path = $this->stripPath( $val, $this->dir ); + // When path starts with tests/parser/ the file would be autodiscovered with + // extension registry, so no need to add it to extension.json + if ( substr( $path, 0, 13 ) !== 'tests/parser/' || substr( $path, -4 ) !== '.txt' ) { + $out[$key] = $path; + } + } + // in the best case all entries are filtered out + if ( $out ) { + $this->json[$realName] = $out; + } + } + protected function handleCredits( $realName, $value ) { $keys = array_keys( $value ); $this->json['type'] = $keys[0];