Add test to prove Event Manager regression

This commit is contained in:
Rachman Chavik 2014-01-31 16:43:42 +07:00
parent 6eb5a38f22
commit 35c22a291e

View file

@ -484,4 +484,24 @@ class CakeEventManagerTest extends CakeTestCase {
CakeEventManager::instance(new CakeEventManager());
}
/**
* test callback
*/
public function onMyEvent($event) {
$event->data['callback'] = 'ok';
}
/**
* Tests events dispatched by a local manager can be handled by
* handler registered in the global event manager
*/
public function testDispatchLocalHandledByGlobal() {
$callback = array($this, 'onMyEvent');
CakeEventManager::instance()->attach($callback, 'my_event');
$manager = new CakeEventManager();
$event = new CakeEvent('my_event', $manager);
$manager->dispatch($event);
$this->assertEquals('ok', $event->data['callback']);
}
}