public function ContainerAwareEventDispatcherTest::testAddAListenerService in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\ContainerAwareEventDispatcherTest::testAddAListenerService()
File
- vendor/
symfony/ event-dispatcher/ Tests/ ContainerAwareEventDispatcherTest.php, line 29
Class
Namespace
Symfony\Component\EventDispatcher\TestsCode
public function testAddAListenerService() {
$event = new Event();
$service = $this
->getMock('Symfony\\Component\\EventDispatcher\\Tests\\Service');
$service
->expects($this
->once())
->method('onEvent')
->with($event);
$container = new Container();
$container
->set('service.listener', $service);
$dispatcher = new ContainerAwareEventDispatcher($container);
$dispatcher
->addListenerService('onEvent', array(
'service.listener',
'onEvent',
));
$dispatcher
->dispatch('onEvent', $event);
}