public function TaggedHandlersPassTest::testserviceIdProcess in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\TaggedHandlersPassTest::testserviceIdProcess()
Tests one consumer and two handlers with service ID collection.
@covers ::process
File
- core/
tests/ Drupal/ Tests/ Core/ DependencyInjection/ Compiler/ TaggedHandlersPassTest.php, line 134 - Contains \Drupal\Tests\Core\DependencyInjection\Compiler\TaggedHandlersPassTest.
Class
- TaggedHandlersPassTest
- @coversDefaultClass \Drupal\Core\DependencyInjection\Compiler\TaggedHandlersPass @group DependencyInjection
Namespace
Drupal\Tests\Core\DependencyInjection\CompilerCode
public function testserviceIdProcess() {
$container = $this
->buildContainer();
$container
->register('consumer_id', __NAMESPACE__ . '\\ValidConsumer')
->addTag('service_id_collector');
$container
->register('handler1', __NAMESPACE__ . '\\ValidHandler')
->addTag('consumer_id');
$container
->register('handler2', __NAMESPACE__ . '\\ValidHandler')
->addTag('consumer_id');
$handler_pass = new TaggedHandlersPass();
$handler_pass
->process($container);
$arguments = $container
->getDefinition('consumer_id')
->getArguments();
$this
->assertCount(1, $arguments);
$this
->assertCount(2, $arguments[0]);
}