You are here

public function InlineServiceDefinitionsPassTest::testProcessDoesNotInlineReferenceWhenUsedByInlineFactory in Zircon Profile 8

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

File

vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php, line 162

Class

InlineServiceDefinitionsPassTest

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

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