8000 Enable cache-reloading when cache file is rebuilt. · symfony/symfony@ba2a01e · GitHub
[go: up one dir, main page]

Skip to content

Commit ba2a01e

Browse files
author
stampy
committed
Enable cache-reloading when cache file is rebuilt.
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.
1 parent fd0d288 commit ba2a01e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,16 +478,23 @@ protected function initializeContainer()
478478
{
479479
$class = $this->getContainerClass();
480480
$cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug);
481+
static $classn = '';
481482
$fresh = true;
482483
if (!$cache->isFresh()) {
483484
$container = $this->buildContainer();
484485
$container->compile();
486+
$classn = (is_numeric($classn) ? $classn+1 : 1);
487+
$class .= $classn;
485488
$this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass());
486489

487490
$fresh = false;
491+
} else {
492+
$class .= $classn;
488493
}
489494

490-
require_once $cache->getPath();
495+
if(!class_exists($class)) {
496+
require $cache->getPath();
497+
}
491498

492499
$this->container = new $class();
493500
$this->container->set('kernel', $this);

0 commit comments

Comments
 (0)
0