mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
commit
5690d423c8
2 changed files with 17 additions and 1 deletions
|
@ -224,7 +224,7 @@ class CakeEventManager {
|
|||
*/
|
||||
public function dispatch($event) {
|
||||
if (is_string($event)) {
|
||||
$Event = new CakeEvent($event);
|
||||
$event = new CakeEvent($event);
|
||||
}
|
||||
|
||||
if (!$this->_isGlobal) {
|
||||
|
|
|
@ -210,6 +210,22 @@ class CakeEventManagerTest extends CakeTestCase {
|
|||
$manager->dispatch($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests event dispatching using event key name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDispatchWithKeyName() {
|
||||
$manager = new CakeEventManager;
|
||||
$listener = new CakeEventTestListener;
|
||||
$manager->attach(array($listener, 'listenerFunction'), 'fake.event');
|
||||
$event = 'fake.event';
|
||||
$manager->dispatch($event);
|
||||
|
||||
$expected = array('listenerFunction');
|
||||
$this->assertEquals($expected, $listener->callStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests event dispatching with a return value
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue