You are here

public function TaggedHandlersPassTest::testProcessNoConsumers in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php \Drupal\Tests\Core\DependencyInjection\Compiler\TaggedHandlersPassTest::testProcessNoConsumers()

Tests without any consumers.

@covers ::process

File

core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php, line 33
Contains \Drupal\Tests\Core\DependencyInjection\Compiler\TaggedHandlersPassTest.

Class

TaggedHandlersPassTest
@coversDefaultClass \Drupal\Core\DependencyInjection\Compiler\TaggedHandlersPass @group DependencyInjection

Namespace

Drupal\Tests\Core\DependencyInjection\Compiler

Code

public function testProcessNoConsumers() {
  $container = $this
    ->buildContainer();
  $container
    ->register('consumer_id', __NAMESPACE__ . '\\ValidConsumer');
  $handler_pass = new TaggedHandlersPass();
  $handler_pass
    ->process($container);
  $this
    ->assertCount(2, $container
    ->getDefinitions());
  $this
    ->assertFalse($container
    ->getDefinition('consumer_id')
    ->hasMethodCall('addHandler'));
}