|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace DachcomBundle\Test\App; |
| 4 | + |
| 5 | +use Pimcore\Kernel; |
| 6 | +use Symfony\Component\Config\Loader\LoaderInterface; |
| 7 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 8 | + |
| 9 | +class TestAppKernel extends Kernel |
| 10 | +{ |
| 11 | + /** |
| 12 | + * {@inheritdoc} |
| 13 | + */ |
| 14 | + public function registerContainerConfiguration(LoaderInterface $loader) |
| 15 | + { |
| 16 | + parent::registerContainerConfiguration($loader); |
| 17 | + |
| 18 | + $bundleClass = getenv('DACHCOM_BUNDLE_HOME'); |
| 19 | + $bundleName = getenv('DACHCOM_BUNDLE_NAME'); |
| 20 | + $configName = getenv('DACHCOM_BUNDLE_CONFIG_FILE'); |
| 21 | + |
| 22 | + if ($configName !== false) { |
| 23 | + \Codeception\Util\Debug::debug(sprintf('[%s] add custom config file %s', strtoupper($bundleName), $configName)); |
| 24 | + $loader->load($bundleClass . '/etc/config/bundle/symfony/' . $configName); |
| 25 | + } |
| 26 | + } |
| 27 | + |
| 28 | + /** |
| 29 | + * {@inheritdoc} |
| 30 | + */ |
| 31 | + public function registerBundlesToCollection(\Pimcore\HttpKernel\BundleCollection\BundleCollection $collection) |
| 32 | + { |
| 33 | + if (class_exists('\\AppBundle\\AppBundle')) { |
| 34 | + $collection->addBundle(new \AppBundle\AppBundle()); |
| 35 | + } |
| 36 | + |
| 37 | + $collection->addBundle(new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle()); |
| 38 | + |
| 39 | + $bundleClass = getenv('DACHCOM_BUNDLE_CLASS'); |
| 40 | + $collection->addBundle(new $bundleClass()); |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * @param ContainerBuilder $container |
| 45 | + */ |
| 46 | + protected function build(ContainerBuilder $container) |
| 47 | + { |
| 48 | + $container->addCompilerPass(new \DachcomBundle\Test\DependencyInjection\MakeServicesPublicPass(), |
| 49 | + \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, -100000); |
| 50 | + $container->addCompilerPass(new \DachcomBundle\Test\DependencyInjection\MonologChannelLoggerPass(), |
| 51 | + \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 1); |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * {@inheritdoc} |
| 56 | + */ |
| 57 | + public function boot() |
| 58 | + { |
| 59 | + parent::boot(); |
| 60 | + \Pimcore::setKernel($this); |
| 61 | + } |
| 62 | +} |
0 commit comments