public function ContainerAwareEventDispatcherTest::testTriggerAListenerServiceOutOfScope

@expectedException \InvalidArgumentException

File

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

Class

ContainerAwareEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests

Code

public function testTriggerAListenerServiceOutOfScope() {
  $service = $this
    ->getMock('Symfony\\Component\\EventDispatcher\\Tests\\Service');
  $scope = new Scope('scope');
  $container = new Container();
  $container
    ->addScope($scope);
  $container
    ->enterScope('scope');
  $container
    ->set('service.listener', $service, 'scope');
  $dispatcher = new ContainerAwareEventDispatcher($container);
  $dispatcher
    ->addListenerService('onEvent', array(
    'service.listener',
    'onEvent',
  ));
  $container
    ->leaveScope('scope');
  $dispatcher
    ->dispatch('onEvent');
}