Skip to content

Commit

Permalink
failing test case for laminas#106
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen Dietz authored and Steffen Dietz committed Mar 9, 2023
1 parent 97930db commit e490673
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
9 changes: 9 additions & 0 deletions test/ContainerResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions test/TestAsset/Module/BootstrappableModule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace LaminasTest\Cli\TestAsset\Module;

use Laminas\EventManager\EventInterface;
use Laminas\ModuleManager\Feature\BootstrapListenerInterface;

class BootstrappableModule implements BootstrapListenerInterface
{
private bool $bootstrapped = false;

public function onBootstrap(EventInterface $e)
{
$this->bootstrapped = true;
}

public function wasBootstrapped(): bool
{
return $this->bootstrapped;
}
}
4 changes: 3 additions & 1 deletion test/TestAsset/config/application.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
namespace LaminasTest\Cli\TestAsset;

return [
'modules' => [],
'modules' => [
Module\BootstrappableModule::class,
],
'module_listener_options' => [],
'laminas-cli' => [
'commands' => [
Expand Down

0 comments on commit e490673

Please sign in to comment.