public function ContainerAwareEventDispatcherTest::testGetListenersOnLazyLoad

File

drupal/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php, line 183

Class

ContainerAwareEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests

Code

public function testGetListenersOnLazyLoad() {
  $event = new Event();
  $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'));
}