Skip to content

Commit

Permalink
[DependencyInjection] added compiler passes as resources
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 16, 2011
1 parent 5c64ca8 commit d5c9f37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -45,6 +45,9 @@ public function __construct(ParameterBagInterface $parameterBag = null)
parent::__construct($parameterBag);

$this->compiler = new Compiler();
foreach ($this->compiler->getPassConfig()->getPasses() as $pass) {
$this->addObjectResource($pass);
}
}

/**
Expand Down Expand Up @@ -150,6 +153,8 @@ public function loadFromExtension($extension, $tag, array $values = array())
public function addCompilerPass(CompilerPassInterface $pass)
{
$this->compiler->addPass($pass);

$this->addObjectResource($pass);
}

/**
Expand Down
Expand Up @@ -410,7 +410,13 @@ public function testResources()
$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');
}

/**
Expand Down

0 comments on commit d5c9f37

Please sign in to comment.