You are here

public function DecoratorServicePassTest::testProcessWithoutAlias in Zircon Profile 8.0

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

File

vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php, line 11

Class

DecoratorServicePassTest

Namespace

Symfony\Component\DependencyInjection\Tests\Compiler

Code

public function testProcessWithoutAlias() {
  $container = new ContainerBuilder();
  $fooDefinition = $container
    ->register('foo')
    ->setPublic(false);
  $fooExtendedDefinition = $container
    ->register('foo.extended')
    ->setPublic(true)
    ->setDecoratedService('foo');
  $barDefinition = $container
    ->register('bar')
    ->setPublic(true);
  $barExtendedDefinition = $container
    ->register('bar.extended')
    ->setPublic(true)
    ->setDecoratedService('bar', 'bar.yoo');
  $this
    ->process($container);
  $this
    ->assertEquals('foo.extended', $container
    ->getAlias('foo'));
  $this
    ->assertFalse($container
    ->getAlias('foo')
    ->isPublic());
  $this
    ->assertEquals('bar.extended', $container
    ->getAlias('bar'));
  $this
    ->assertTrue($container
    ->getAlias('bar')
    ->isPublic());
  $this
    ->assertSame($fooDefinition, $container
    ->getDefinition('foo.extended.inner'));
  $this
    ->assertFalse($container
    ->getDefinition('foo.extended.inner')
    ->isPublic());
  $this
    ->assertSame($barDefinition, $container
    ->getDefinition('bar.yoo'));
  $this
    ->assertFalse($container
    ->getDefinition('bar.yoo')
    ->isPublic());
  $this
    ->assertNull($fooExtendedDefinition
    ->getDecoratedService());
  $this
    ->assertNull($barExtendedDefinition
    ->getDecoratedService());
}