function RecipeEventsTest::register

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Recipe/RecipeEventsTest.php \Drupal\KernelTests\Core\Recipe\RecipeEventsTest::register()

Registers test-specific services.

Extend this method in your test to register additional services. This method is called whenever the kernel is rebuilt.

Parameters

\Drupal\Core\DependencyInjection\ContainerBuilder $container: The service container to enhance.

Overrides KernelTestBase::register

File

core/tests/Drupal/KernelTests/Core/Recipe/RecipeEventsTest.php, line 45

Class

RecipeEventsTest
@group Recipe

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function register(ContainerBuilder $container) : void {
  parent::register($container);
  // Every time the container is rebuilt, ensure this object is subscribing to
  // events.
  $container->getDefinition('event_dispatcher')
    ->addMethodCall('addSubscriber', [
    $this,
  ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.