function ContainerAwareEventDispatcherTest::testRemoveSubscriber

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

File

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

Class

ContainerAwareEventDispatcherTest
Unit tests for the ContainerAwareEventDispatcher.

Namespace

Drupal\Tests\Component\EventDispatcher

Code

public function testRemoveSubscriber() {
    $eventSubscriber = new TestEventSubscriber();
    $this->dispatcher
        ->addSubscriber($eventSubscriber);
    $this->assertTrue($this->dispatcher
        ->hasListeners(self::PRE_FOO));
    $this->assertTrue($this->dispatcher
        ->hasListeners(self::POST_FOO));
    $this->dispatcher
        ->removeSubscriber($eventSubscriber);
    $this->assertFalse($this->dispatcher
        ->hasListeners(self::PRE_FOO));
    $this->assertFalse($this->dispatcher
        ->hasListeners(self::POST_FOO));
}

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