Skip to content

Commit b25c1d3

Browse files
committed
Fix complete config tests
1 parent 2af58be commit b25c1d3

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ abstract class CompleteConfigurationTest extends \PHPUnit_Framework_TestCase
2121
{
2222
private static $containerCache = array();
2323

24-
abstract protected function loadFromFile(ContainerBuilder $container, $file);
24+
abstract protected function getLoader(ContainerBuilder $container);
25+
26+
abstract protected function getFileExtension();
2527

2628
public function testRolesHierarchy()
2729
{
@@ -237,6 +239,8 @@ public function testRememberMeThrowExceptions()
237239

238240
protected function getContainer($file)
239241
{
242+
$file = $file.'.'.$this->getFileExtension();
243+
240244
if (isset(self::$containerCache[$file])) {
241245
return self::$containerCache[$file];
242246
}
@@ -246,7 +250,7 @@ protected function getContainer($file)
246250

247251
$bundle = new SecurityBundle();
248252
$bundle->build($container); // Attach all default factories
249-
$this->loadFromFile($container, $file);
253+
$this->getLoader($container)->load($file);
250254

251255
$container->getCompilerPassConfig()->setOptimizationPasses(array());
252256
$container->getCompilerPassConfig()->setRemovingPasses(array());

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/PhpCompleteConfigurationTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717

1818
class PhpCompleteConfigurationTest extends CompleteConfigurationTest
1919
{
20-
protected function loadFromFile(ContainerBuilder $container, $file)
20+
protected function getLoader(ContainerBuilder $container)
2121
{
22-
$loadXml = new PhpFileLoader($container, new FileLocator(__DIR__.'/Fixtures/php'));
23-
$loadXml->load($file.'.php');
22+
return new PhpFileLoader($container, new FileLocator(__DIR__.'/Fixtures/php'));
23+
}
24+
25+
protected function getFileExtension()
26+
{
27+
return 'php';
2428
}
2529
}

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCompleteConfigurationTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717

1818
class XmlCompleteConfigurationTest extends CompleteConfigurationTest
1919
{
20-
protected function loadFromFile(ContainerBuilder $container, $file)
20+
protected function getLoader(ContainerBuilder $container)
2121
{
22-
$loadXml = new XmlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/xml'));
23-
$loadXml->load($file.'.xml');
22+
return new XmlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/xml'));
23+
}
24+
25+
protected function getFileExtension()
26+
{
27+
return 'xml';
2428
}
2529
}

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/YamlCompleteConfigurationTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717

1818
class YamlCompleteConfigurationTest extends CompleteConfigurationTest
1919
{
20-
protected function loadFromFile(ContainerBuilder $container, $file)
20+
protected function getLoader(ContainerBuilder $container)
2121
{
22-
$loadXml = new YamlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/yml'));
23-
$loadXml->load($file.'.yml');
22+
return new YamlFileLoader($container, new FileLocator(__DIR__.'/Fixtures/yml'));
23+
}
24+
25+
protected function getFileExtension()
26+
{
27+
return 'yml';
2428
}
2529
}

0 commit comments

Comments
 (0)