Add bootstrapping for tests, add praise instead of warning in case of

attribution licenses
This commit is contained in:
2025-07-06 13:06:49 +02:00
parent a0621216ec
commit f66fd1d9a0
5 changed files with 142 additions and 17 deletions

48
tests/bootstrap.php Normal file
View File

@ -0,0 +1,48 @@
<?PHP
/**
* Bootstraps tests by running provideEnv and then resetting the error handler.
*/
declare(strict_types = 1);
define('TL_FILE_DIRS', [
__DIR__ . '/../../../l10n/musdb/',
__DIR__ . '/../../../l10n/quality-web/',
__DIR__ . '/../../importer/dependencies/MDAllowedValueSets/l18n/',
]);
/**
* Autoloader for musdb.
*
* @param string $className Name of the class to load.
*
* @return void
*/
\spl_autoload_register(function(string $className):void {
// Try using class map as defined through /scripts/buildClassMap.php
foreach ([
__DIR__ . '/../tests',
__DIR__ . '/../src',
__DIR__ . '/../src/Checks',
__DIR__ . '/../src/Checks/Puqi',
__DIR__ . '/../src/Checks/Plausi',
__DIR__ . '/../../importer/dependencies/MDAllowedValueSets/src',
__DIR__ . '/../../importer/dependencies/MDAllowedValueSets/exceptions',
__DIR__ . '/../../importer/dependencies/MDErrorReporter/src',
__DIR__ . '/../../importer/dependencies/MDErrorReporter/exceptions',
__DIR__ . '/../../importer/dependencies/MDTlLoader/src',
__DIR__ . '/../../importer/dependencies/MDTlLoader/exceptions',
] as $classDir) {
if (\file_exists("$classDir/$className.php")) {
include "$classDir/$className.php";
return;
}
}
});
restore_error_handler();
restore_exception_handler();