AutoLoader: ignore plugin enabled/disabled during unit tests

This is required currently because the enabled status of a plugin is
only set when it's appropriate test runs. However some plugins do setup
mock classes before the test is instantiated which will then fail.
So for now we skip the enabled checks alltogether for unit testing.
This commit is contained in:
Andreas Gohr 2023-09-14 17:50:55 +02:00
parent 4602718be5
commit ff13677348
1 changed files with 2 additions and 2 deletions

View File

@ -173,7 +173,7 @@ return new class {
if (file_exists($file)) {
$plugin = substr($classPath, 0, strpos($classPath, '/'));
// don't load disabled plugin classes (only if plugin controller is available)
if ($plugin_controller && plugin_isdisabled($plugin)) return false;
if (!defined('DOKU_UNITTEST') && $plugin_controller && plugin_isdisabled($plugin)) return false;
try {
require $file;
@ -253,7 +253,7 @@ return new class {
$plg = DOKU_PLUGIN . "{$m[2]}/{$m[1]}$c.php";
if (file_exists($plg)) {
// don't load disabled plugin classes (only if plugin controller is available)
if ($plugin_controller && plugin_isdisabled($m[2])) return false;
if (!defined('DOKU_UNITTEST') && $plugin_controller && plugin_isdisabled($m[2])) return false;
try {
require $plg;
} catch (\Throwable $e) {