-
Notifications
You must be signed in to change notification settings - Fork 0
/
.symfony_checker
40 lines (32 loc) · 1.08 KB
/
.symfony_checker
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
<?php
declare(strict_types=1);
use PedroTroller\Symfony\IntegrationChecker\ConfigurableKernel;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\KernelInterface;
$config = [
'framework' => [
'translator' => [
'enabled' => true,
],
],
];
$test = function (KernelInterface $kernel): void {
if ($kernel->getContainer()->get('translator') instanceof \Symfony\Contracts\Translation\TranslatorInterface) {
return;
}
if ($kernel->getContainer()->get('translator') instanceof \Symfony\Component\Translation\TranslatorInterface) {
return;
}
throw new \Exception('Oups, there is a problem !');
};
return function (ConfigurableKernel $kernel) use ($config, $test): void {
$container = new ContainerBuilder();
$container->setParameter('kernel.secret', md5((string) time()));
$kernel
->setContainerBuilder($container)
->setConfig($config)
->addBundle(new FrameworkBundle())
->afterBoot($test)
;
};