public function AbstractEventDispatcherTest::testStopEventPropagation in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\AbstractEventDispatcherTest::testStopEventPropagation()
File
- vendor/
symfony/ event-dispatcher/ Tests/ AbstractEventDispatcherTest.php, line 147
Class
Namespace
Symfony\Component\EventDispatcher\TestsCode
public function testStopEventPropagation() {
$otherListener = new TestEventListener();
// postFoo() stops the propagation, so only one listener should
// be executed
// Manually set priority to enforce $this->listener to be called first
$this->dispatcher
->addListener('post.foo', array(
$this->listener,
'postFoo',
), 10);
$this->dispatcher
->addListener('post.foo', array(
$otherListener,
'preFoo',
));
$this->dispatcher
->dispatch(self::postFoo);
$this
->assertTrue($this->listener->postFooInvoked);
$this
->assertFalse($otherListener->postFooInvoked);
}