X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fsuites%2FParserTestTopLevelSuite.php;h=4ea1090f6e3c93a35e206586a1ed0f4dafa2068c;hb=802c199d0bd80ff0f4d730c61fd58cbf08a52d8d;hp=5d5d693571152664302e8281830bfbc76a828824;hpb=dfaa26a7b19ab65190a76cd32259a3637cc3e2fd;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/suites/ParserTestTopLevelSuite.php b/tests/phpunit/suites/ParserTestTopLevelSuite.php index 5d5d693571..4ea1090f6e 100644 --- a/tests/phpunit/suites/ParserTestTopLevelSuite.php +++ b/tests/phpunit/suites/ParserTestTopLevelSuite.php @@ -69,7 +69,7 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite { if ( is_string( $flags ) ) { $flags = self::CORE_ONLY; } - global $wgParserTestFiles, $IP; + global $IP; $mwTestDir = $IP . '/tests/'; @@ -81,15 +81,16 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite { $filesToTest = []; # Filter out .txt files - foreach ( $wgParserTestFiles as $parserTestFile ) { + $files = ParserTestRunner::getParserTestFiles(); + foreach ( $files as $extName => $parserTestFile ) { $isCore = ( 0 === strpos( $parserTestFile, $mwTestDir ) ); if ( $isCore && $wantsCore ) { self::debug( "included core parser tests: $parserTestFile" ); - $filesToTest[] = $parserTestFile; + $filesToTest[$extName] = $parserTestFile; } elseif ( !$isCore && $wantsRest ) { self::debug( "included non core parser tests: $parserTestFile" ); - $filesToTest[] = $parserTestFile; + $filesToTest[$extName] = $parserTestFile; } else { self::debug( "skipped parser tests: $parserTestFile" ); } @@ -99,12 +100,13 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite { $testList = []; $counter = 0; - foreach ( $filesToTest as $fileName ) { - // Call the highest level directory the extension name. - // It may or may not actually be, but it should be close - // enough to cause there to be separate names for different - // things, which is good enough for our purposes. - $extensionName = basename( dirname( $fileName ) ); + foreach ( $filesToTest as $extensionName => $fileName ) { + if ( is_int( $extensionName ) ) { + // If there's no extension name because this is coming + // from the legacy global, then assume the next level directory + // is the extension name (e.g. extensions/FooBar/parserTests.txt). + $extensionName = basename( dirname( $fileName ) ); + } $testsName = $extensionName . '__' . basename( $fileName, '.txt' ); $parserTestClassName = ucfirst( $testsName );