Skip to content

Commit

Permalink
[HttpKernel] enabled cache-reloading when cache file is rebuilt
Browse files Browse the repository at this point in the history
This allows the cache file to be deleted and thus rebuilt between Container builds in WebTestCase scenario, to enable testing of multiple configurations of the same application through WebTestCase.
  • Loading branch information
stampy committed Sep 23, 2016
1 parent fd0d288 commit f089031
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Symfony/Component/HttpKernel/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,19 @@ protected function initializeContainer()
if (!$cache->isFresh()) {
$container = $this->buildContainer();
$container->compile();
for ($classVersion = 0; class_exists($class . ($classVersion ?: '')); $classVersion++);
$class .= $classVersion ?: '';
$this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass());

$fresh = false;
} else {
for ($classVersion = 0; class_exists($class . ($classVersion ?: '')); $classVersion++);
$class .= $classVersion ? $classVersion - 1 : '';
}

require_once $cache->getPath();
if(!class_exists($class)) {
require $cache->getPath();
}

$this->container = new $class();
$this->container->set('kernel', $this);
Expand Down

0 comments on commit f089031

Please sign in to comment.