function ContainerAwareEventDispatcherTest::testRemoveFindsLazyListeners
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testRemoveFindsLazyListeners()
- 8.9.x core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testRemoveFindsLazyListeners()
- 10 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testRemoveFindsLazyListeners()
File
-
core/
tests/ Drupal/ Tests/ Component/ EventDispatcher/ ContainerAwareEventDispatcherTest.php, line 509
Class
- ContainerAwareEventDispatcherTest
- Unit tests for the ContainerAwareEventDispatcher.
Namespace
Drupal\Tests\Component\EventDispatcherCode
public function testRemoveFindsLazyListeners() {
$test = new TestWithDispatcher();
$factory = function () use ($test) {
return $test;
};
$this->dispatcher
->addListener('foo', [
$factory,
'foo',
]);
$this->assertTrue($this->dispatcher
->hasListeners('foo'));
$this->dispatcher
->removeListener('foo', [
$test,
'foo',
]);
$this->assertFalse($this->dispatcher
->hasListeners('foo'));
$this->dispatcher
->addListener('foo', [
$test,
'foo',
]);
$this->assertTrue($this->dispatcher
->hasListeners('foo'));
$this->dispatcher
->removeListener('foo', [
$factory,
'foo',
]);
$this->assertFalse($this->dispatcher
->hasListeners('foo'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.