public function TraceableEventDispatcherTest::testListenerCanRemoveItselfWhenExecuted in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\Debug\TraceableEventDispatcherTest::testListenerCanRemoveItselfWhenExecuted()
- 8.0 vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php \Symfony\Component\HttpKernel\Tests\Debug\TraceableEventDispatcherTest::testListenerCanRemoveItselfWhenExecuted()
Same name and namespace in other branches
- 8 vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\Debug\TraceableEventDispatcherTest::testListenerCanRemoveItselfWhenExecuted()
File
- vendor/
symfony/ event-dispatcher/ Tests/ Debug/ TraceableEventDispatcherTest.php, line 179
Class
Namespace
Symfony\Component\EventDispatcher\Tests\DebugCode
public function testListenerCanRemoveItselfWhenExecuted() {
$eventDispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$listener1 = function ($event, $eventName, EventDispatcherInterface $dispatcher) use (&$listener1) {
$dispatcher
->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');
}