public function TraceableEventDispatcherTest::testDispatchNested

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php, line 151

Class

TraceableEventDispatcherTest

Namespace

Symfony\Component\HttpKernel\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');
}