[DI] move RegisterServiceSubscribersPass before DecoratorServicePass
This commit is contained in:
parent
3096665d64
commit
c3271d9385
@ -51,12 +51,12 @@ class PassConfig
|
||||
$this->optimizationPasses = array(array(
|
||||
new ResolveChildDefinitionsPass(),
|
||||
new ServiceLocatorTagPass(),
|
||||
new RegisterServiceSubscribersPass(),
|
||||
new DecoratorServicePass(),
|
||||
new ResolveParameterPlaceHoldersPass(false),
|
||||
new ResolveFactoryClassPass(),
|
||||
new FactoryReturnTypePass($resolveClassPass),
|
||||
new CheckDefinitionValidityPass(),
|
||||
new RegisterServiceSubscribersPass(),
|
||||
new ResolveNamedArgumentsPass(),
|
||||
new AutowireRequiredMethodsPass(),
|
||||
new ResolveBindingsPass(),
|
||||
|
@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\Alias;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
|
||||
|
||||
/**
|
||||
* This class tests the integration of the different compiler passes.
|
||||
@ -117,6 +118,21 @@ class IntegrationTest extends TestCase
|
||||
$this->assertFalse($container->hasDefinition('c'), 'Service C was not inlined.');
|
||||
}
|
||||
|
||||
public function testCanDecorateServiceSubscriber()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->register(ServiceSubscriberStub::class)
|
||||
->addTag('container.service_subscriber')
|
||||
->setPublic(true);
|
||||
|
||||
$container->register(DecoratedServiceSubscriber::class)
|
||||
->setDecoratedService(ServiceSubscriberStub::class);
|
||||
|
||||
$container->compile();
|
||||
|
||||
$this->assertInstanceOf(DecoratedServiceSubscriber::class, $container->get(ServiceSubscriberStub::class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getYamlCompileTests
|
||||
*/
|
||||
@ -207,6 +223,18 @@ class IntegrationTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
class ServiceSubscriberStub implements ServiceSubscriberInterface
|
||||
{
|
||||
public static function getSubscribedServices()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
class DecoratedServiceSubscriber
|
||||
{
|
||||
}
|
||||
|
||||
class IntegrationTestStub extends IntegrationTestStubParent
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user