You are here

public function InlineServiceDefinitionsPassTest::testProcessDoesNotInlineReferenceWhenUsedByInlineFactory in Service Container 7

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

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/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]);
}