You are here

public function YamlFileLoaderTest::testLoadImports in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\YamlFileLoaderTest::testLoadImports()

File

vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php, line 103

Class

YamlFileLoaderTest

Namespace

Symfony\Component\DependencyInjection\Tests\Loader

Code

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');
}