Commit bbd96cc9 authored by xjm's avatar xjm

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
......@@ -77,6 +77,7 @@ class TaggedHandlersPass implements CompilerPassInterface {
public function process(ContainerBuilder $container) {
foreach ($container->findTaggedServiceIds('service_collector') as $consumer_id => $passes) {
foreach ($passes as $pass) {
$interface = NULL;
$tag = isset($pass['tag']) ? $pass['tag'] : $consumer_id;
$method_name = isset($pass['call']) ? $pass['call'] : 'addHandler';
$required = isset($pass['required']) ? $pass['required'] : FALSE;
......
......@@ -64,13 +64,16 @@ public function testProcessRequiredHandlers() {
* Tests consumer with missing interface in non-production environment.
*
* @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
*/
public function testProcessMissingInterface() {
$container = $this->buildContainer();
$container
->register('consumer_id', __NAMESPACE__ . '\InvalidConsumer')
->register('consumer_id0', __NAMESPACE__ . '\ValidConsumer')
->addTag('service_collector');
$container
->register('consumer_id1', __NAMESPACE__ . '\InvalidConsumer')
->addTag('service_collector');
$handler_pass = new TaggedHandlersPass();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment