fix(modules): improve dependency handling and diagnostics for module loading

This commit is contained in:
Divarion-D
2026-06-30 22:41:46 +03:00
parent 8d6debee8b
commit 2995d69b4d
7 changed files with 238 additions and 18 deletions
+5 -4
View File
@@ -85,15 +85,16 @@ final class ModuleLoaderPriorityTest extends TestCase {
);
}
public function testRequiredDependencyStillThrowsWhenMissing(): void {
public function testRequiredDependencyMissingSkipsDependentWithoutThrowing(): void {
$root = $this->createModulesRoot();
$this->createModule($root, 'needs-ghost', ['dependencies' => ['ghost-module']]);
$loader = new ModuleLoader();
$this->expectException(RuntimeException::class);
$this->expectExceptionMessageMatches('/requires missing dependency/');
$loader->loadAll($root);
// A missing required dependency must skip only the dependent, never abort
// the whole load.
$this->assertFalse($loader->isLoaded('needs-ghost'));
}
// ── Helpers ───────────────────────────────────────────────