File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
/**
3
- * ControllerTestCaseTest file
4
- *
5
- * Test Case for ControllerTestCase class
6
- *
7
3
* CakePHP : Rapid Development Framework (http://cakephp.org)
8
4
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
9
5
*
@@ -504,4 +500,22 @@ public function testDispatchLocalHandledByGlobal() {
504
500
$ this ->assertEquals ('ok ' , $ event ->data ['callback ' ]);
505
501
}
506
502
503
+ /**
504
+ * Test that events are dispatched properly when there are global and local
505
+ * listeners at the same priority.
506
+ *
507
+ * @return void
508
+ */
509
+ public function testDispatchWithGlobalAndLocalEvents () {
510
+ $ listener = new CustomTestEventListener ();
511
+ CakeEventManager::instance ()->attach ($ listener );
512
+ $ listener2 = new CakeEventTestListener ();
513
+ $ manager = new CakeEventManager ();
514
+ $ manager ->attach ([$ listener2 , 'listenerFunction ' ], 'fake.event ' );
515
+
516
+ $ manager ->dispatch (new CakeEvent ('fake.event ' , $ this ));
517
+ $ this ->assertEquals (array ('listenerFunction ' ), $ listener ->callStack );
518
+ $ this ->assertEquals (array ('listenerFunction ' ), $ listener2 ->callStack );
519
+ }
520
+
507
521
}
You can’t perform that action at this time.
0 commit comments