public function testDispatchByPriority() {
$invoked = array();
$listener1 = function () use (&$invoked) {
$invoked[] = '1';
};
$listener2 = function () use (&$invoked) {
$invoked[] = '2';
};
$listener3 = function () use (&$invoked) {
$invoked[] = '3';
};
$this->dispatcher
->addListener('pre.foo', $listener1, -10);
$this->dispatcher
->addListener('pre.foo', $listener2);
$this->dispatcher
->addListener('pre.foo', $listener3, 10);
$this->dispatcher
->dispatch(self::preFoo);
$this
->assertEquals(array(
'3',
'2',
'1',
), $invoked);
}