public function XmlFileLoaderTest::testLoadInlinedServices 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::testLoadInlinedServices()
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Loader/ XmlFileLoaderTest.php, line 469
Class
Namespace
Symfony\Component\DependencyInjection\Tests\LoaderCode
public function testLoadInlinedServices() {
$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml'));
$loader
->load('services21.xml');
$foo = $container
->getDefinition('foo');
$fooFactory = $foo
->getFactory();
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $fooFactory[0]);
$this
->assertSame('FooFactory', $fooFactory[0]
->getClass());
$this
->assertSame('createFoo', $fooFactory[1]);
$fooFactoryFactory = $fooFactory[0]
->getFactory();
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $fooFactoryFactory[0]);
$this
->assertSame('Foobar', $fooFactoryFactory[0]
->getClass());
$this
->assertSame('createFooFactory', $fooFactoryFactory[1]);
$fooConfigurator = $foo
->getConfigurator();
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $fooConfigurator[0]);
$this
->assertSame('Bar', $fooConfigurator[0]
->getClass());
$this
->assertSame('configureFoo', $fooConfigurator[1]);
$barConfigurator = $fooConfigurator[0]
->getConfigurator();
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $barConfigurator[0]);
$this
->assertSame('Baz', $barConfigurator[0]
->getClass());
$this
->assertSame('configureBar', $barConfigurator[1]);
}