diff --git a/lib/Cake/Test/Case/Event/CakeEventManagerTest.php b/lib/Cake/Test/Case/Event/CakeEventManagerTest.php index 8c3653de3..a21c4975b 100644 --- a/lib/Cake/Test/Case/Event/CakeEventManagerTest.php +++ b/lib/Cake/Test/Case/Event/CakeEventManagerTest.php @@ -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']); + } + }