You are here

public function LegacyContainerBuilderTest::testCreateServiceFactoryService in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/LegacyContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\LegacyContainerBuilderTest::testCreateServiceFactoryService()

@covers Symfony\Component\DependencyInjection\ContainerBuilder::createService

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/LegacyContainerBuilderTest.php, line 43

Class

LegacyContainerBuilderTest
@group legacy

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testCreateServiceFactoryService() {
  $builder = new ContainerBuilder();
  $builder
    ->register('baz_service')
    ->setFactoryService('baz_factory')
    ->setFactoryMethod('getInstance');
  $builder
    ->register('baz_factory', 'BazClass');
  $this
    ->assertInstanceOf('BazClass', $builder
    ->get('baz_service'));
}