Skip to content

Commit

Permalink
[SecurityBundle] Optimize dependency injection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paradajozsef authored and fabpot committed Jan 23, 2016
1 parent 9a90cde commit bf56d2f
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -19,6 +19,8 @@

abstract class CompleteConfigurationTest extends \PHPUnit_Framework_TestCase
{
private static $containerCache = array();

abstract protected function loadFromFile(ContainerBuilder $container, $file);

public function testRolesHierarchy()
Expand Down Expand Up @@ -182,6 +184,9 @@ public function testCustomAclProvider()

protected function getContainer($file)
{
if (isset(self::$containerCache[$file])) {
return self::$containerCache[$file];
}
$container = new ContainerBuilder();
$security = new SecurityExtension();
$container->registerExtension($security);
Expand All @@ -194,6 +199,6 @@ protected function getContainer($file)
$container->getCompilerPassConfig()->setRemovingPasses(array());
$container->compile();

return $container;
return self::$containerCache[$file] = $container;
}
}

0 comments on commit bf56d2f

Please sign in to comment.