You are here

public function AbstractEventDispatcherTest::testRemoveSubscriber in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\AbstractEventDispatcherTest::testRemoveSubscriber()

File

vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php, line 222

Class

AbstractEventDispatcherTest

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));
}