You are here

public function ContainerAwareEventDispatcherTest::testGetListenersOnLazyLoad in Zircon Profile 8

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

File

vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php, line 183

Class

ContainerAwareEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests

Code

public function testGetListenersOnLazyLoad() {
  $service = $this
    ->getMock('Symfony\\Component\\EventDispatcher\\Tests\\Service');
  $container = new Container();
  $container
    ->set('service.listener', $service);
  $dispatcher = new ContainerAwareEventDispatcher($container);
  $dispatcher
    ->addListenerService('onEvent', array(
    'service.listener',
    'onEvent',
  ));
  $listeners = $dispatcher
    ->getListeners();
  $this
    ->assertTrue(isset($listeners['onEvent']));
  $this
    ->assertCount(1, $dispatcher
    ->getListeners('onEvent'));
}