You are here

public function InlineServiceDefinitionsPassTest::testProcessDoesNotInlinePrivateFactoryIfReferencedMultipleTimesWithinTheSameDefinition in Service Container 7.2

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

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php, line 136

Class

InlineServiceDefinitionsPassTest

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcessDoesNotInlinePrivateFactoryIfReferencedMultipleTimesWithinTheSameDefinition() {
  $container = new ContainerBuilder();
  $container
    ->register('a');
  $container
    ->register('b')
    ->setPublic(false)
    ->setFactory(array(
    new Reference('a'),
    'a',
  ));
  $container
    ->register('foo')
    ->setArguments(array(
    $ref1 = new Reference('b'),
    $ref2 = new Reference('b'),
  ));
  $this
    ->process($container);
  $args = $container
    ->getDefinition('foo')
    ->getArguments();
  $this
    ->assertSame($ref1, $args[0]);
  $this
    ->assertSame($ref2, $args[1]);
}