public function testDispatchNested() {
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$loop = 1;
$dispatcher
->addListener('foo', $listener1 = function () use ($dispatcher, &$loop) {
++$loop;
if (2 == $loop) {
$dispatcher
->dispatch('foo');
}
});
$dispatcher
->dispatch('foo');
}