Skip to content
Snippets Groups Projects
Commit bbd96cc9 authored by Jess's avatar Jess
Browse files

Issue #2852515 by dawehner, timmillwood: $interface is still set from the...

Issue #2852515 by dawehner, timmillwood: $interface is still set from the previous loop in tagged services compilation
parent f57baee5
No related branches found
No related tags found
No related merge requests found
...@@ -77,6 +77,7 @@ class TaggedHandlersPass implements CompilerPassInterface { ...@@ -77,6 +77,7 @@ class TaggedHandlersPass implements CompilerPassInterface {
public function process(ContainerBuilder $container) { public function process(ContainerBuilder $container) {
foreach ($container->findTaggedServiceIds('service_collector') as $consumer_id => $passes) { foreach ($container->findTaggedServiceIds('service_collector') as $consumer_id => $passes) {
foreach ($passes as $pass) { foreach ($passes as $pass) {
$interface = NULL;
$tag = isset($pass['tag']) ? $pass['tag'] : $consumer_id; $tag = isset($pass['tag']) ? $pass['tag'] : $consumer_id;
$method_name = isset($pass['call']) ? $pass['call'] : 'addHandler'; $method_name = isset($pass['call']) ? $pass['call'] : 'addHandler';
$required = isset($pass['required']) ? $pass['required'] : FALSE; $required = isset($pass['required']) ? $pass['required'] : FALSE;
......
...@@ -64,13 +64,16 @@ public function testProcessRequiredHandlers() { ...@@ -64,13 +64,16 @@ public function testProcessRequiredHandlers() {
* Tests consumer with missing interface in non-production environment. * Tests consumer with missing interface in non-production environment.
* *
* @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
* @expectedExceptionMessage Service consumer 'consumer_id' class method Drupal\Tests\Core\DependencyInjection\Compiler\InvalidConsumer::addHandler() has to type-hint an interface. * @expectedExceptionMessage Service consumer 'consumer_id1' class method Drupal\Tests\Core\DependencyInjection\Compiler\InvalidConsumer::addHandler() has to type-hint an interface.
* @covers ::process * @covers ::process
*/ */
public function testProcessMissingInterface() { public function testProcessMissingInterface() {
$container = $this->buildContainer(); $container = $this->buildContainer();
$container $container
->register('consumer_id', __NAMESPACE__ . '\InvalidConsumer') ->register('consumer_id0', __NAMESPACE__ . '\ValidConsumer')
->addTag('service_collector');
$container
->register('consumer_id1', __NAMESPACE__ . '\InvalidConsumer')
->addTag('service_collector'); ->addTag('service_collector');
$handler_pass = new TaggedHandlersPass(); $handler_pass = new TaggedHandlersPass();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment