bug #18699 [DependencyInjection] Use the priority of service decoration on service with parent (hason)

This PR was merged into the 2.8 branch.

Discussion
----------

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

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

d1ad43c [DependencyInjection] Fixed the priority of service decoration on service with parent
This commit is contained in:
Fabien Potencier 2016-05-03 14:26:31 +02:00
commit dd27b7d183
2 changed files with 5 additions and 3 deletions

View File

@ -174,7 +174,7 @@ class ResolveDefinitionTemplatesPass implements CompilerPassInterface
if (null === $decoratedService) {
$def->setDecoratedService($decoratedService);
} 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->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()