public function ContainerAwareEventDispatcherTest::testRemoveSubscriber in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testRemoveSubscriber()
- 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 430
Class
- ContainerAwareEventDispatcherTest
- Unit tests for the ContainerAwareEventDispatcher.
Namespace
Drupal\Tests\Component\EventDispatcherCode
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));
}