diff --git a/test/ContainerResolverTest.php b/test/ContainerResolverTest.php index 9617fd6..02e1462 100644 --- a/test/ContainerResolverTest.php +++ b/test/ContainerResolverTest.php @@ -11,8 +11,10 @@ use bovigo\vfs\vfsStream; use Laminas\Cli\ApplicationFactory; use Laminas\Cli\ContainerResolver; +use Laminas\ModuleManager\ModuleManagerInterface; use Laminas\ServiceManager\ServiceManager; use LaminasTest\Cli\TestAsset\ExampleDependency; +use LaminasTest\Cli\TestAsset\Module\BootstrappableModule; use PHPUnit\Framework\TestCase; use RuntimeException; use Symfony\Component\Console\Input\InputInterface; @@ -63,6 +65,13 @@ public function testWillLoadContainerFromApplicationConfig(): void $container = $resolver->resolve($input); self::assertInstanceOf(ServiceManager::class, $container); self::assertTrue($container->has(ExampleDependency::class)); + + /** @var ModuleManagerInterface $moduleManager */ + $moduleManager = $container->get('ModuleManager'); + /** @var BootstrappableModule $bootstrappableModule */ + $bootstrappableModule = $moduleManager->getLoadedModules(false)[BootstrappableModule::class]; + + self::assertTrue($bootstrappableModule->wasBootstrapped()); } public function testWillLoadContainerFromMezzioContainerPath(): void diff --git a/test/TestAsset/Module/BootstrappableModule.php b/test/TestAsset/Module/BootstrappableModule.php new file mode 100644 index 0000000..2700f44 --- /dev/null +++ b/test/TestAsset/Module/BootstrappableModule.php @@ -0,0 +1,23 @@ +bootstrapped = true; + } + + public function wasBootstrapped(): bool + { + return $this->bootstrapped; + } +} diff --git a/test/TestAsset/config/application.config.php b/test/TestAsset/config/application.config.php index 62409e1..1fac937 100644 --- a/test/TestAsset/config/application.config.php +++ b/test/TestAsset/config/application.config.php @@ -5,7 +5,9 @@ namespace LaminasTest\Cli\TestAsset; return [ - 'modules' => [], + 'modules' => [ + Module\BootstrappableModule::class, + ], 'module_listener_options' => [], 'laminas-cli' => [ 'commands' => [