You are here

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

File

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

Class

TraceableEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests\Debug

Code

public function testGetCalledListenersNested() {
  $tdispatcher = null;
  $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
  $dispatcher
    ->addListener('foo', function (Event $event, $eventName, $dispatcher) use (&$tdispatcher) {
    $tdispatcher = $dispatcher;
    $dispatcher
      ->dispatch('bar');
  });
  $dispatcher
    ->addListener('bar', function (Event $event) {
  });
  $dispatcher
    ->dispatch('foo');
  $this
    ->assertSame($dispatcher, $tdispatcher);
  $this
    ->assertCount(2, $dispatcher
    ->getCalledListeners());
}