[DependencyInjection] Fixed the priority of service decoration on service with parent

This commit is contained in:
Martin Hasoň 2016-05-03 11:49:32 +02:00
parent 7b3c65bf67
commit d1ad43c174
2 changed files with 5 additions and 3 deletions

View File

@ -174,7 +174,7 @@ class ResolveDefinitionTemplatesPass implements CompilerPassInterface
if (null === $decoratedService) { if (null === $decoratedService) {
$def->setDecoratedService($decoratedService); $def->setDecoratedService($decoratedService);
} else { } else {
$def->setDecoratedService($decoratedService[0], $decoratedService[1]); $def->setDecoratedService($decoratedService[0], $decoratedService[1], $decoratedService[2]);
} }
} }

View File

@ -276,10 +276,12 @@ class ResolveDefinitionTemplatesPassTest extends \PHPUnit_Framework_TestCase
$container->register('parent', 'stdClass'); $container->register('parent', 'stdClass');
$container->setDefinition('child1', new DefinitionDecorator('parent')) $container->setDefinition('child1', new DefinitionDecorator('parent'))
->setDecoratedService('foo', 'foo_inner') ->setDecoratedService('foo', 'foo_inner', 5)
; ;
$this->assertEquals(array('foo', 'foo_inner', 0), $container->getDefinition('child1')->getDecoratedService()); $this->process($container);
$this->assertEquals(array('foo', 'foo_inner', 5), $container->getDefinition('child1')->getDecoratedService());
} }
public function testDecoratedServiceCopiesDeprecatedStatusFromParent() public function testDecoratedServiceCopiesDeprecatedStatusFromParent()