You are here

public function XmlFileLoaderTest::testParsesTags in Zircon Profile 8

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

File

vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php, line 248

Class

XmlFileLoaderTest

Namespace

Symfony\Component\DependencyInjection\Tests\Loader

Code

public function testParsesTags() {
  $container = new ContainerBuilder();
  $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml'));
  $loader
    ->load('services10.xml');
  $services = $container
    ->findTaggedServiceIds('foo_tag');
  $this
    ->assertCount(1, $services);
  foreach ($services as $id => $tagAttributes) {
    foreach ($tagAttributes as $attributes) {
      $this
        ->assertArrayHasKey('other_option', $attributes);
      $this
        ->assertEquals('lorem', $attributes['other_option']);
      $this
        ->assertArrayHasKey('other-option', $attributes, 'unnormalized tag attributes should not be removed');
      $this
        ->assertEquals('ciz', $attributes['some_option'], 'no overriding should be done when normalizing');
      $this
        ->assertEquals('cat', $attributes['some-option']);
      $this
        ->assertArrayNotHasKey('an_other_option', $attributes, 'normalization should not be done when an underscore is already found');
    }
  }
}