Cast results of implementedEvents to an array.

This makes using mocks much easier with event listeners as they don't
need to provide a returnValue for implementedEvents.

Refs #2333
This commit is contained in:
mark_story 2013-12-03 22:39:14 -05:00
parent a57c46ff93
commit e6f2c92005

View file

@ -122,7 +122,7 @@ class CakeEventManager {
* @return void * @return void
*/ */
protected function _attachSubscriber(CakeEventListener $subscriber) { protected function _attachSubscriber(CakeEventListener $subscriber) {
foreach ($subscriber->implementedEvents() as $eventKey => $function) { foreach ((array)$subscriber->implementedEvents() as $eventKey => $function) {
$options = array(); $options = array();
$method = $function; $method = $function;
if (is_array($function) && isset($function['callable'])) { if (is_array($function) && isset($function['callable'])) {