- $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
- $definition->expects($this->atLeastOnce())
- ->method('isPublic')
- ->will($this->returnValue(true));
- $definition->expects($this->atLeastOnce())
- ->method('getClass')
- ->will($this->returnValue('Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService'));
-
- $builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition', 'findDefinition'))->getMock();
- $builder->expects($this->any())
- ->method('hasDefinition')
- ->will($this->returnValue(true));
-
- // We don't test kernel.event_listener here
- $builder->expects($this->atLeastOnce())
- ->method('findTaggedServiceIds')
- ->will($this->onConsecutiveCalls(array(), $services));
-
- $builder->expects($this->atLeastOnce())
- ->method('getDefinition')
- ->will($this->returnValue($definition));
-
- $builder->expects($this->atLeastOnce())
- ->method('findDefinition')
- ->will($this->returnValue($definition));
+ $builder = new ContainerBuilder();
+ $eventDispatcherDefinition = $builder->register('event_dispatcher');
+ $builder->register('my_event_subscriber', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService')
+ ->addTag('kernel.event_subscriber');