mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Add test to prove Event Manager regression
This commit is contained in:
parent
6eb5a38f22
commit
35c22a291e
1 changed files with 20 additions and 0 deletions
|
@ -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']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue