function ContainerAwareEventDispatcherTest::testRemoveListener

File

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

Class

ContainerAwareEventDispatcherTest
Unit tests for the ContainerAwareEventDispatcher.

Namespace

Drupal\Tests\Component\EventDispatcher

Code

public function testRemoveListener() {
  $this->dispatcher
    ->addListener('pre.bar', $this->listener);
  $this->assertTrue($this->dispatcher
    ->hasListeners(self::PREBAR));
  $this->dispatcher
    ->removeListener('pre.bar', $this->listener);
  $this->assertFalse($this->dispatcher
    ->hasListeners(self::PREBAR));
  $this->dispatcher
    ->removeListener('notExists', $this->listener);
}

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