Fix complete config tests
This commit is contained in:
parent
2af58be68f
commit
b25c1d30f6
|
@ -21,7 +21,9 @@ abstract class CompleteConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
private static $containerCache = array();
|
||||
|
||||
abstract protected function loadFromFile(ContainerBuilder $container, $file);
|
||||
abstract protected function getLoader(ContainerBuilder $container);
|
||||
|
||||
abstract protected function getFileExtension();
|
||||
|
||||
public function testRolesHierarchy()
|
||||
{
|
||||
|
@ -237,6 +239,8 @@ abstract class CompleteConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
protected function getContainer($file)
|
||||
{
|
||||
$file = $file.'.'.$this->getFileExtension();
|
||||
|
||||
if (isset(self::$containerCache[$file])) {
|
||||
return self::$containerCache[$file];
|
||||
}
|
||||
|
@ -246,7 +250,7 @@ abstract class CompleteConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$bundle = new SecurityBundle();
|
||||
$bundle->build($container); // Attach all default factories
|
||||
$this->loadFromFile($container, $file);
|
||||
$this->getLoader($container)->load($file);
|
||||
|
||||
$container->getCompilerPassConfig()->setOptimizationPasses(array());
|
||||
$container->getCompilerPassConfig()->setRemovingPasses(array());
|
||||
|
|
|
@ -17,9 +17,13 @@ use Symfony\Component\Config\FileLocator;
|
|||
|
||||
class PhpCompleteConfigurationTest extends CompleteConfigurationTest
|
||||
{
|
||||
protected function loadFromFile(ContainerBuilder $container, $file)
|
||||
protected function getLoader(ContainerBuilder $container)
|
||||
{
|
||||
$loadXml = new PhpFileLoader($container, new FileLocator(__DIR__.'/Fixtures/php'));
|
||||
$loadXml->load($file.'.php');
|
||||
return new PhpFileLoader($container, new FileLocator(__DIR__.'/Fixtures/php'));
|
||||
}
|
||||
|
||||
protected function getFileExtension()
|
||||
{
|
||||
return 'php';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,13 @@ use Symfony\Component\Config\FileLocator;
|
|||
|
||||
class XmlCompleteConfigurationTest extends CompleteConfigurationTest
|
||||
{
|
||||
protected function loadFromFile(ContainerBuilder $container, $file)
|
||||
protected function getLoader(ContainerBuilder $container)
|
||||
{
|
||||
$loadXml = new XmlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/xml'));
|
||||
$loadXml->load($file.'.xml');
|
||||
return new XmlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/xml'));
|
||||
}
|
||||
|
||||
protected function getFileExtension()
|
||||
{
|
||||
return 'xml';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,9 +17,13 @@ use Symfony\Component\Config\FileLocator;
|
|||
|
||||
class YamlCompleteConfigurationTest extends CompleteConfigurationTest
|
||||
{
|
||||
protected function loadFromFile(ContainerBuilder $container, $file)
|
||||
protected function getLoader(ContainerBuilder $container)
|
||||
{
|
||||
$loadXml = new YamlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/yml'));
|
||||
$loadXml->load($file.'.yml');
|
||||
return new YamlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/yml'));
|
||||
}
|
||||
|
||||
protected function getFileExtension()
|
||||
{
|
||||
return 'yml';
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue