public function ContainerBuilderTest::testCreateService in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testCreateService()
@covers Symfony\Component\DependencyInjection\ContainerBuilder::createService
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ ContainerBuilderTest.php, line 277
Class
Namespace
Symfony\Component\DependencyInjection\TestsCode
public function testCreateService() {
$builder = new ContainerBuilder();
$builder
->register('foo1', 'Bar\\FooClass')
->setFile(__DIR__ . '/Fixtures/includes/foo.php');
$this
->assertInstanceOf('\\Bar\\FooClass', $builder
->get('foo1'), '->createService() requires the file defined by the service definition');
$builder
->register('foo2', 'Bar\\FooClass')
->setFile(__DIR__ . '/Fixtures/includes/%file%.php');
$builder
->setParameter('file', 'foo');
$this
->assertInstanceOf('\\Bar\\FooClass', $builder
->get('foo2'), '->createService() replaces parameters in the file provided by the service definition');
}