Skip to content

Commit 21b4619

Browse files
committed
Merge branch '2.3' into 2.7
* 2.3: [Process] Remove a misleading comment Improve the phpdoc of SplFileInfo methods [Process] Use stream based storage to avoid memory issues Fixed the documentation of VoterInterface::supportsAttribute Remove useless duplicated tests [FrameworkBundle] Optimize framework extension tests Use is_subclass_of instead of Reflection when possible
2 parents c52bcdc + b34048b commit 21b4619

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
abstract class FrameworkExtensionTest extends TestCase
2424
{
25+
private static $containerCache = array();
26+
2527
abstract protected function loadFromFile(ContainerBuilder $container, $file);
2628

2729
public function testCsrfProtection()
@@ -470,6 +472,10 @@ protected function createContainer(array $data = array())
470472

471473
protected function createContainerFromFile($file, $data = array())
472474
{
475+
$cacheKey = md5($file.serialize($data));
476+
if (isset(self::$containerCache[$cacheKey])) {
477+
return self::$containerCache[$cacheKey];
478+
}
473479
$container = $this->createContainer($data);
474480
$container->registerExtension(new FrameworkExtension());
475481
$this->loadFromFile($container, $file);
@@ -478,7 +484,7 @@ protected function createContainerFromFile($file, $data = array())
478484
$container->getCompilerPassConfig()->setRemovingPasses(array());
479485
$container->compile();
480486

481-
return $container;
487+
return self::$containerCache[$cacheKey] = $container;
482488
}
483489

484490
protected function createContainerFromClosure($closure, $data = array())

0 commit comments

Comments
 (0)