You are here

public function TraceableEventDispatcherTest::testDispatchReusedEventNested 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::testDispatchReusedEventNested()

File

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

Class

TraceableEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests\Debug

Code

public function testDispatchReusedEventNested() {
  $nestedCall = false;
  $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
  $dispatcher
    ->addListener('foo', function (Event $e) use ($dispatcher) {
    $dispatcher
      ->dispatch('bar', $e);
  });
  $dispatcher
    ->addListener('bar', function (Event $e) use (&$nestedCall) {
    $nestedCall = true;
  });
  $this
    ->assertFalse($nestedCall);
  $dispatcher
    ->dispatch('foo');
  $this
    ->assertTrue($nestedCall);
}