Message: add strict type to protected Message::$language
[mediawiki.git] / tests / phpunit / getPHPUnitExtensionsAndSkins.php
blob6a6f28e03b4612f854f59265a3d484b0c3467764
1 #!/usr/bin/env php
2 <?php
4 /**
5 * WARNING: Hic sunt dracones!
7 * This script is used in the PHPUnit bootstrap to get a list of extensions and skins to autoload,
8 * without having the bootstrap file itself load any settings. It is a HUGE but unavoidable hack,
9 * if we want to avoid loading settings in unit tests, and at the same time only load the extensions
10 * enabled in LocalSettings.php without triggering any other side effects of Setup.php and the other
11 * files it includes.
12 * One day this may become unnecessary if we enforce YAML settings with a static list of extensions
13 * and skins (https://www.mediawiki.org/wiki/Manual:YAML_settings_file_format).
14 * The script was introduced for T227900, the idea being to have a single config file that can be used
15 * with both unit and integration tests.
16 * @internal This script should only be invoked by bootstrap.php, as part of the PHPUnit bootstrap process
19 use MediaWiki\HookContainer\HookRunner;
20 use MediaWiki\MediaWikiServices;
22 require_once __DIR__ . '/bootstrap.common.php';
24 TestSetup::loadSettingsFiles();
26 $extensionsAndSkins = ExtensionRegistry::getInstance()->getQueue();
28 echo implode( "\n", array_keys( $extensionsAndSkins ) );
30 echo "\n\nTESTPATHS\n\n";
32 // Build a list of extension tests, based on autodiscovered tests as well as tests added with the
33 // UnitTestsList hook. The list is only to be used in ExtensionsTestSuite.
34 // This is a hack inside the hack, motivated by the fact that we can't access MediaWikiServices, or even
35 // just the config needed to create a hook container, as early as when ExtensionsTestSuite::suite is called.
36 // This particular hack can be removed once the UnitTestsList hook is removed (T298509)
37 $registry = ExtensionRegistry::getInstance();
38 foreach ( $registry->getAllThings() as $info ) {
39 $paths[] = dirname( $info['path'] ) . '/tests/phpunit';
41 // Extensions can return a list of files or directories
42 ( new HookRunner( MediaWikiServices::getInstance()->getHookContainer() ) )->onUnitTestsList( $paths );
44 echo implode( "\n", $paths );