You are here

public function InlineServiceDefinitionsPassTest::testProcessDoesInlineServiceOfPrototypeScope 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::testProcessDoesInlineServiceOfPrototypeScope()

File

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

Class

InlineServiceDefinitionsPassTest

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcessDoesInlineServiceOfPrototypeScope() {
  $container = new ContainerBuilder();
  $container
    ->register('foo')
    ->setScope('prototype');
  $container
    ->register('bar')
    ->setPublic(false)
    ->setScope('prototype');
  $container
    ->setAlias('moo', 'bar');
  $container
    ->register('service')
    ->setArguments(array(
    new Reference('foo'),
    $ref = new Reference('moo'),
    new Reference('bar'),
  ));
  $this
    ->process($container);
  $arguments = $container
    ->getDefinition('service')
    ->getArguments();
  $this
    ->assertEquals($container
    ->getDefinition('foo'), $arguments[0]);
  $this
    ->assertNotSame($container
    ->getDefinition('foo'), $arguments[0]);
  $this
    ->assertSame($ref, $arguments[1]);
  $this
    ->assertEquals($container
    ->getDefinition('bar'), $arguments[2]);
  $this
    ->assertNotSame($container
    ->getDefinition('bar'), $arguments[2]);
}