Add bootstrapping for tests, add praise instead of warning in case of
attribution licenses
This commit is contained in:
		
							
								
								
									
										48
									
								
								tests/bootstrap.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								tests/bootstrap.php
									
									
									
									
									
										Normal 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(); | ||||
		Reference in New Issue
	
	Block a user