[HttpKernel] Don't reset on shutdown but in FrameworkBundle/Test/KernelTestCase

This commit is contained in:
Nicolas Grekas 2015-11-20 13:11:01 +01:00
parent b6857ba405
commit baad4da9b7
2 changed files with 5 additions and 5 deletions

View File

@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Test; namespace Symfony\Bundle\FrameworkBundle\Test;
use Symfony\Component\DependencyInjection\ResettableContainerInterface;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
@ -171,7 +172,11 @@ abstract class KernelTestCase extends \PHPUnit_Framework_TestCase
protected static function ensureKernelShutdown() protected static function ensureKernelShutdown()
{ {
if (null !== static::$kernel) { if (null !== static::$kernel) {
$container = static::$kernel->getContainer();
static::$kernel->shutdown(); static::$kernel->shutdown();
if ($container instanceof ResettableContainerInterface) {
$container->reset();
}
} }
} }

View File

@ -23,7 +23,6 @@ use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader; use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
use Symfony\Component\DependencyInjection\ResettableContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Bundle\BundleInterface;
@ -171,10 +170,6 @@ abstract class Kernel implements KernelInterface, TerminableInterface
$bundle->setContainer(null); $bundle->setContainer(null);
} }
if ($this->container instanceof ResettableContainerInterface) {
$this->container->reset();
}
$this->container = null; $this->container = null;
} }