public function EventDispatcherTest::testRemoveSubscriber

File

drupal/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php, line 208

Class

EventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests

Code

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