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
->assertEquals('pre.foo', $event
->getName());
$this
->assertSame($event, $return);
}