[DependencyInjection] added compiler passes as resources
This commit is contained in:
parent
5c64ca8a30
commit
d5c9f37982
@ -45,6 +45,9 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
parent::__construct($parameterBag);
|
||||
|
||||
$this->compiler = new Compiler();
|
||||
foreach ($this->compiler->getPassConfig()->getPasses() as $pass) {
|
||||
$this->addObjectResource($pass);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,6 +153,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
public function addCompilerPass(CompilerPassInterface $pass)
|
||||
{
|
||||
$this->compiler->addPass($pass);
|
||||
|
||||
$this->addObjectResource($pass);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -410,7 +410,13 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$container = new ContainerBuilder();
|
||||
$container->addResource($a = new FileResource(__DIR__.'/Fixtures/xml/services1.xml'));
|
||||
$container->addResource($b = new FileResource(__DIR__.'/Fixtures/xml/services2.xml'));
|
||||
$this->assertEquals(array($a, $b), $container->getResources(), '->getResources() returns an array of resources read for the current configuration');
|
||||
$resources = array();
|
||||
foreach ($container->getResources() as $resource) {
|
||||
if (false === strpos($resource, '.php')) {
|
||||
$resources[] = $resource;
|
||||
}
|
||||
}
|
||||
$this->assertEquals(array($a, $b), $resources, '->getResources() returns an array of resources read for the current configuration');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user