Files
kupshop/bundles/KupShop/DevelopmentBundle/Util/Tests/TestAppKernel.php
2025-08-02 16:30:27 +02:00

40 lines
1.1 KiB
PHP

<?php
namespace KupShop\DevelopmentBundle\Util\Tests;
use KupShop\KupShopBundle\KupShopAppKernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Contracts\Service\ResetInterface;
class TestAppKernel extends KupShopAppKernel
{
protected static $connection;
public function registerContainerConfiguration(LoaderInterface $loader)
{
global $cfg;
$loader->load(realpath($cfg['Path']['shared_version']).'/bundles/KupShop/KupShopBundle/Resources/config/config_'.$this->getEnvironment().'.yml');
}
protected function initializeContainer()
{
parent::initializeContainer();
if (!self::$connection) {
self::$connection = sqlGetConnection();
} else {
$this->getContainer()->set('doctrine.dbal.default_connection', self::$connection);
}
}
public function shutdown()
{
// call reset before shutdown to be memory freed correctly
if ($this->getContainer() instanceof ResetInterface) {
$this->getContainer()->reset();
}
parent::shutdown();
}
}