You are here

public function ContainerAwareEventDispatcherTest::testGetListenersWhenAddedCallbackListenerIsRemoved in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testGetListenersWhenAddedCallbackListenerIsRemoved()
  2. 9 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testGetListenersWhenAddedCallbackListenerIsRemoved()

File

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

Class

ContainerAwareEventDispatcherTest
Unit tests for the ContainerAwareEventDispatcher.

Namespace

Drupal\Tests\Component\EventDispatcher

Code

public function testGetListenersWhenAddedCallbackListenerIsRemoved() {
  $listener = function () {
  };
  $this->dispatcher
    ->addListener('foo', $listener);
  $this->dispatcher
    ->removeListener('foo', $listener);
  $this
    ->assertSame([], $this->dispatcher
    ->getListeners());
}