Exemplo n.º 1
0
 public function testChangePropagationState()
 {
     $instance = new DispatchContext();
     $this->assertFalse($instance->isPropagationStopped());
     $instance->set('proPagationSTOP', true);
     $this->assertTrue($instance->isPropagationStopped());
 }
 public function testDispatchSomeEventsThroughAdHocListener()
 {
     $mockTester = $this->getMockBuilder('\\stdClass')->setMethods(array('doSomething'))->getMock();
     $mockTester->expects($this->once())->method('doSomething');
     $eventDispatcherFactory = new EventDispatcherFactory();
     $eventDispatcher = $eventDispatcherFactory->newGenericEventDispatcher();
     $eventDispatcher->addListener('notify.bar', new BarListener());
     $dispatchContext = new DispatchContext();
     $dispatchContext->set('mock', $mockTester);
     $eventDispatcher->dispatch('notify.bar', $dispatchContext);
     $eventDispatcher->dispatch('try.notify.empty.listener');
 }