public function YamlFileLoaderTest::testLoadImports in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\YamlFileLoaderTest::testLoadImports()
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Loader/ YamlFileLoaderTest.php, line 102
Class
Namespace
Symfony\Component\DependencyInjection\Tests\LoaderCode
public function testLoadImports() {
$container = new ContainerBuilder();
$resolver = new LoaderResolver(array(
new IniFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')),
new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')),
new PhpFileLoader($container, new FileLocator(self::$fixturesPath . '/php')),
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath . '/yaml')),
));
$loader
->setResolver($resolver);
$loader
->load('services4.yml');
$actual = $container
->getParameterBag()
->all();
$expected = array(
'foo' => 'bar',
'values' => array(
true,
false,
),
'bar' => '%foo%',
'escape' => '@escapeme',
'foo_bar' => new Reference('foo_bar'),
'mixedcase' => array(
'MixedCaseKey' => 'value',
),
'imported_from_ini' => true,
'imported_from_xml' => true,
);
$this
->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files');
// Bad import throws no exception due to ignore_errors value.
$loader
->load('services4_bad_import.yml');
}