tests: add skins to PHPUnit "extensions:unit" test suite

When running tests, there is no need to differentiate between extensions
and skins. When generating coverage, CI uses extensions:unit and
skins:unit, they only differ by the paths they filter.

This change extensions:unit to no more filter path, it would then
discover tests under $IP/skins/.  In CI, this will let us switch skins
to use the same job used by extensions therefore simplifying the stack.

Bug: T395470
Bug: T402398
Change-Id: Ifaeb8c2e278acca89a92187ac39a6c0e1eb503f9
(cherry picked from commit 515e35d5b0b3e66e63f8209447aa3888b18a442f)
This commit is contained in:
Antoine Musso 2025-09-08 10:46:17 +02:00 committed by jenkins-bot
parent f749c4e9eb
commit acaa3a63a7

View file

@ -13,20 +13,11 @@ class ExtensionsUnitTestSuite extends TestSuite {
if ( !defined( 'MW_PHPUNIT_EXTENSIONS_PATHS' ) ) {
throw new RuntimeException( 'The PHPUnit bootstrap was not loaded' );
}
$paths = [];
$suffixes = [ 'Test.php' ];
$fileIterator = new Facade();
foreach ( MW_PHPUNIT_EXTENSIONS_PATHS as $path ) {
// Note that we don't load settings, so we expect to find extensions in their
// default location
// Standardize directory separators for Windows compatibility.
if ( str_contains( strtr( $path, '\\', '/' ), '/extensions/' ) ) {
$paths[] = "$path/tests/phpunit/unit";
}
}
foreach ( array_unique( $paths ) as $path ) {
$suffixes = [ 'Test.php' ];
$fileIterator = new Facade();
$matchingFiles = $fileIterator->getFilesAsArray( $path, $suffixes );
$this->addTestFiles( $matchingFiles );
$this->addTestFiles( $fileIterator->getFilesAsArray( "$path/tests/phpunit/unit", $suffixes ) );
}
}