You are here

public function InlineServiceDefinitionsPassTest::testProcessDoesNotInlinePrivateFactoryIfReferencedMultipleTimesWithinTheSameDefinition in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php \Symfony\Component\DependencyInjection\Tests\Compiler\InlineServiceDefinitionsPassTest::testProcessDoesNotInlinePrivateFactoryIfReferencedMultipleTimesWithinTheSameDefinition()

File

vendor/symfony/dependency-injection/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]);
}