public function testDispatchForClosure() {
$invoked = 0;
$listener = function () use (&$invoked) {
$invoked++;
};
$this->dispatcher
->addListener('pre.foo', $listener);
$this->dispatcher
->addListener('post.foo', $listener);
$this->dispatcher
->dispatch(self::preFoo);
$this
->assertEquals(1, $invoked);
}