You are here

public function TraceableEventDispatcherTest::testDispatchNested in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\Debug\TraceableEventDispatcherTest::testDispatchNested()

File

vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php, line 149

Class

TraceableEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests\Debug

Code

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');
}