-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestKernel.php
48 lines (41 loc) · 1.54 KB
/
TestKernel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
namespace Tiime\TestedRoutesCheckerBundle\Tests;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Tiime\TestedRoutesCheckerBundle\Command\CheckCommand;
use Tiime\TestedRoutesCheckerBundle\TiimeTestedRoutesCheckerBundle;
class TestKernel extends Kernel
{
/** @param array<string, array<string, mixed>|null> $config */
public function __construct(
private readonly array $config,
) {
parent::__construct('test', true);
}
public function registerBundles(): iterable
{
yield new FrameworkBundle();
yield new TiimeTestedRoutesCheckerBundle();
}
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(function (ContainerBuilder $container) {
foreach ($this->config as $extension => $config) {
$container->loadFromExtension($extension, $config);
}
});
}
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new class implements CompilerPassInterface {
public function process(ContainerBuilder $container): void
{
$container->setAlias(CheckCommand::class, 'tiime_tested_routes_checker_bundle.command.check')->setPublic(true);
}
});
}
}