public function XmlFileLoaderTest::testNoNamingConflictsForAnonymousServices in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\XmlFileLoaderTest::testNoNamingConflictsForAnonymousServices()
File
- vendor/
symfony/ dependency-injection/ Tests/ Loader/ XmlFileLoaderTest.php, line 404
Class
Namespace
Symfony\Component\DependencyInjection\Tests\LoaderCode
public function testNoNamingConflictsForAnonymousServices() {
$container = new ContainerBuilder();
$loader1 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml/extension1'));
$loader1
->load('services.xml');
$services = $container
->getDefinitions();
$this
->assertCount(2, $services, '->load() attributes unique ids to anonymous services');
$loader2 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml/extension2'));
$loader2
->load('services.xml');
$services = $container
->getDefinitions();
$this
->assertCount(4, $services, '->load() attributes unique ids to anonymous services');
$services = $container
->getDefinitions();
$args1 = $services['extension1.foo']
->getArguments();
$inner1 = $services[(string) $args1[0]];
$this
->assertEquals('BarClass1', $inner1
->getClass(), '->load() uses the same configuration as for the anonymous ones');
$args2 = $services['extension2.foo']
->getArguments();
$inner2 = $services[(string) $args2[0]];
$this
->assertEquals('BarClass2', $inner2
->getClass(), '->load() uses the same configuration as for the anonymous ones');
}