-
Notifications
You must be signed in to change notification settings - Fork 18
/
TestAppKernel.php
69 lines (59 loc) · 2.18 KB
/
TestAppKernel.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
namespace DachcomBundle\Test\App;
use Pimcore\Kernel;
use DachcomBundle\Test\DependencyInjection\ServiceChangePass;
use DachcomBundle\Test\DependencyInjection\MakeServicesPublicPass;
use DachcomBundle\Test\DependencyInjection\MonologChannelLoggerPass;
use Pimcore\HttpKernel\BundleCollection\BundleCollection;
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
class TestAppKernel extends Kernel
{
/**
* {@inheritdoc}
*/
public function registerBundlesToCollection(BundleCollection $collection)
{
$collection->addBundle(new WebProfilerBundle());
$bundleClass = getenv('DACHCOM_BUNDLE_CLASS');
$collection->addBundle(new $bundleClass());
if (class_exists('\\AppBundle\\AppBundle')) {
$collection->addBundle(new \AppBundle\AppBundle());
}
}
/**
* {@inheritdoc}
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
parent::registerContainerConfiguration($loader);
$loader->load(function (ContainerBuilder $container) {
$runtimeConfigDir = codecept_data_dir() . 'config' . DIRECTORY_SEPARATOR;
$loader = new YamlFileLoader($container, new FileLocator([$runtimeConfigDir]));
$loader->load('config.yml');
});
}
/**
* @param ContainerBuilder $container
*
* @throws \Exception
*/
protected function build(ContainerBuilder $container)
{
$container->addCompilerPass(new ServiceChangePass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -100000);
$container->addCompilerPass(new MakeServicesPublicPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -100000);
$container->addCompilerPass(new MonologChannelLoggerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1);
}
/**
* {@inheritdoc}
*/
public function boot()
{
parent::boot();
\Pimcore::setKernel($this);
}
}