You are here

public function TraceableEventDispatcherTest::testHasListeners in Zircon Profile 8.0

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

File

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

Class

TraceableEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests\Debug

Code

public function testHasListeners() {
  $dispatcher = new EventDispatcher();
  $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
  $this
    ->assertFalse($dispatcher
    ->hasListeners('foo'));
  $this
    ->assertFalse($tdispatcher
    ->hasListeners('foo'));
  $tdispatcher
    ->addListener('foo', $listener = function () {
  });
  $this
    ->assertTrue($dispatcher
    ->hasListeners('foo'));
  $this
    ->assertTrue($tdispatcher
    ->hasListeners('foo'));
}