function ContainerAwareEventDispatcherTest::testHasListenersWhenAddedCallbackListenerIsRemoved

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testHasListenersWhenAddedCallbackListenerIsRemoved()
  2. 10 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testHasListenersWhenAddedCallbackListenerIsRemoved()
  3. 11.x core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testHasListenersWhenAddedCallbackListenerIsRemoved()

File

core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php, line 490

Class

ContainerAwareEventDispatcherTest
Unit tests for the ContainerAwareEventDispatcher.

Namespace

Drupal\Tests\Component\EventDispatcher

Code

public function testHasListenersWhenAddedCallbackListenerIsRemoved() {
  $listener = function () {
  };
  $this->dispatcher
    ->addListener('foo', $listener);
  $this->dispatcher
    ->removeListener('foo', $listener);
  $this->assertFalse($this->dispatcher
    ->hasListeners());
}

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