10000 [HttpKernel] enabled cache-reloading when cache file is rebuilt · symfony/symfony@f089031 · GitHub
[go: up one dir, main page]

Skip to content

Commit f089031

Browse files
author
stampy
committed
[HttpKernel] enabled 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 f089031

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
@@ -482,12 +482,19 @@ protected function initializeContainer()
482482
if (!$cache->isFresh()) {
483483
$container = $this->buildContainer();
484484
$container->compile();
485+
for ($classVersion = 0; class_exists($class . ($classVersion ?: '')); $classVersion++);
486+
$class .= $classVersion ?: '';
485487
$this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass());
486488

487489
$fresh = false;
490+
} else {
491+
for ($classVersion = 0; class_exists($class . ($classVersion ?: '')); $classVersion++);
492+
$class .= $classVersion ? $classVersion - 1 : '';
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