You are here

public function ContainerBuilderTest::testLegacyCreateServiceFactoryService in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testLegacyCreateServiceFactoryService()

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

File

vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php, line 362

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testLegacyCreateServiceFactoryService() {
  $builder = new ContainerBuilder();
  $builder
    ->register('foo_service', 'Bar\\FooClass');
  $builder
    ->register('foo', 'Bar\\FooClass')
    ->setFactoryService('%foo_service%')
    ->setFactoryMethod('getInstance');
  $builder
    ->setParameter('foo_service', 'foo_service');
  $this
    ->assertTrue($builder
    ->get('foo')->called, '->createService() calls the factory method to create the service instance');
}