public function AbstractEventDispatcherTest::testDispatch 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::testDispatch()
File
- vendor/
symfony/ event-dispatcher/ Tests/ AbstractEventDispatcherTest.php, line 111
Class
Namespace
Symfony\Component\EventDispatcher\TestsCode
public function testDispatch() {
$this->dispatcher
->addListener('pre.foo', array(
$this->listener,
'preFoo',
));
$this->dispatcher
->addListener('post.foo', array(
$this->listener,
'postFoo',
));
$this->dispatcher
->dispatch(self::preFoo);
$this
->assertTrue($this->listener->preFooInvoked);
$this
->assertFalse($this->listener->postFooInvoked);
$this
->assertInstanceOf('Symfony\\Component\\EventDispatcher\\Event', $this->dispatcher
->dispatch('noevent'));
$this
->assertInstanceOf('Symfony\\Component\\EventDispatcher\\Event', $this->dispatcher
->dispatch(self::preFoo));
$event = new Event();
$return = $this->dispatcher
->dispatch(self::preFoo, $event);
$this
->assertSame($event, $return);
}