public function TraceableEventDispatcherTest::testListenerCanRemoveItselfWhenExecuted in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\Debug\TraceableEventDispatcherTest::testListenerCanRemoveItselfWhenExecuted()
- 8 vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php \Symfony\Component\HttpKernel\Tests\Debug\TraceableEventDispatcherTest::testListenerCanRemoveItselfWhenExecuted()
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php \Symfony\Component\HttpKernel\Tests\Debug\TraceableEventDispatcherTest::testListenerCanRemoveItselfWhenExecuted()
File
- vendor/
symfony/ http-kernel/ Tests/ Debug/ TraceableEventDispatcherTest.php, line 96
Class
Namespace
Symfony\Component\HttpKernel\Tests\DebugCode
public function testListenerCanRemoveItselfWhenExecuted() {
$eventDispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$listener1 = function () use ($eventDispatcher, &$listener1) {
$eventDispatcher
->removeListener('foo', $listener1);
};
$eventDispatcher
->addListener('foo', $listener1);
$eventDispatcher
->addListener('foo', function () {
});
$eventDispatcher
->dispatch('foo');
$this
->assertCount(1, $eventDispatcher
->getListeners('foo'), 'expected listener1 to be removed');
}