public function XmlFileLoaderTest::testNoNamingConflictsForAnonymousServices in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\XmlFileLoaderTest::testNoNamingConflictsForAnonymousServices()
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Loader/ XmlFileLoaderTest.php, line 406
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');
}