You are here

public function XmlFileLoaderTest::testLoadParameters in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\XmlFileLoaderTest::testLoadParameters()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php, line 86

Class

XmlFileLoaderTest

Namespace

Symfony\Component\DependencyInjection\Tests\Loader

Code

public function testLoadParameters() {
  $container = new ContainerBuilder();
  $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml'));
  $loader
    ->load('services2.xml');
  $actual = $container
    ->getParameterBag()
    ->all();
  $expected = array(
    'a string',
    'foo' => 'bar',
    'values' => array(
      0,
      'integer' => 4,
      100 => null,
      'true',
      true,
      false,
      'on',
      'off',
      'float' => 1.3,
      1000.3,
      'a string',
      array(
        'foo',
        'bar',
      ),
    ),
    'mixedcase' => array(
      'MixedCaseKey' => 'value',
    ),
    'constant' => PHP_EOL,
  );
  $this
    ->assertEquals($expected, $actual, '->load() converts XML values to PHP ones');
}