You are here

public function ContainerAwareEventDispatcherTest::testTriggerAListenerServiceOutOfScope in Zircon Profile 8.0

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

@expectedException \InvalidArgumentException

File

vendor/symfony/event-dispatcher/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');
}