Do not pass the option array by reference.
authorGunnar Wrobel <p@rdus.de>
Thu, 5 Nov 2009 06:08:01 +0000 (07:08 +0100)
committerGunnar Wrobel <p@rdus.de>
Thu, 5 Nov 2009 06:08:01 +0000 (07:08 +0100)
framework/Notification/lib/Horde/Notification/Handler/Base.php
framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php
framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php
framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php
framework/Notification/lib/Horde/Notification/Handler/Interface.php
framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php

index a905ad1..25b3c27 100644 (file)
@@ -185,7 +185,7 @@ implements Horde_Notification_Handler_Interface
      */
     public function notify(array $options = array())
     {
-        $this->setNotificationListeners($options);
+        $options = $this->setNotificationListeners($options);
         $this->notifyListeners($options);
     }
 
@@ -196,7 +196,7 @@ implements Horde_Notification_Handler_Interface
      * @param array $options  An array containing display options for the
      *                        listeners.
      */
-    public function setNotificationListeners(array &$options)
+    public function setNotificationListeners(array $options)
     {
         if (!isset($options['listeners'])) {
             $options['listeners'] =  $this->getListeners();
@@ -204,6 +204,7 @@ implements Horde_Notification_Handler_Interface
             $options['listeners'] = array($options['listeners']);
         }
         $options['listeners'] = array_map(array('Horde_String', 'lower'), $options['listeners']);
+        return $options;
     }
 
     /**
index 26d2e5a..a704ae0 100644 (file)
@@ -126,7 +126,7 @@ implements Horde_Notification_Handler_Interface
      */
     public function notify(array $options = array())
     {
-        $this->_handler->setNotificationListeners($options);
+        $options = $this->_handler->setNotificationListeners($options);
 
         if (in_array('status', $options['listeners'])) {
             $this->_alarm->notify(Horde_Auth::getAuth());
@@ -142,9 +142,9 @@ implements Horde_Notification_Handler_Interface
      * @param array $options  An array containing display options for the
      *                        listeners.
      */
-    public function setNotificationListeners(array &$options)
+    public function setNotificationListeners(array $options)
     {
-        $this->_handler->setNotificationListeners($options);
+        return $this->_handler->setNotificationListeners($options);
     }
 
     /**
index 5054f5f..773bb21 100644 (file)
@@ -130,9 +130,9 @@ implements Horde_Notification_Handler_Interface
      * @param array $options  An array containing display options for the
      *                        listeners.
      */
-    public function setNotificationListeners(array &$options)
+    public function setNotificationListeners(array $options)
     {
-        $this->_handler->setNotificationListeners($options);
+        return $this->_handler->setNotificationListeners($options);
     }
 
     /**
index adf7a3c..4c9e147 100644 (file)
@@ -151,9 +151,9 @@ implements Horde_Notification_Handler_Interface
      * @param array $options  An array containing display options for the
      *                        listeners.
      */
-    public function setNotificationListeners(array &$options)
+    public function setNotificationListeners(array $options)
     {
-        $this->_handler->setNotificationListeners($options);
+        return $this->_handler->setNotificationListeners($options);
     }
 
     /**
index c321284..229adfc 100644 (file)
@@ -91,7 +91,7 @@ interface Horde_Notification_Handler_Interface
      * @param array $options  An array containing display options for the
      *                        listeners.
      */
-    public function setNotificationListeners(array &$options);
+    public function setNotificationListeners(array $options);
 
     /**
      * Passes the message stack to all listeners and asks them to
index 962e84e..fe23ff3 100644 (file)
@@ -52,7 +52,8 @@ extends PHPUnit_Framework_TestCase
             ->with('');
         $this->handler->expects($this->once())
             ->method('setNotificationListeners')
-            ->with(array('listeners' => array('status')));
+            ->with(array('listeners' => array('status')))
+            ->will($this->returnValue(array('listeners' => array('status'))));
         $this->handler->expects($this->once())
             ->method('notifyListeners')
             ->with(array('listeners' => array('status')));
@@ -103,7 +104,8 @@ extends PHPUnit_Framework_TestCase
     {
         $this->handler->expects($this->once())
             ->method('setNotificationListeners')
-            ->with(array('listeners' => array('test')));
+            ->with(array('listeners' => array('test')))
+            ->will($this->returnValue(array('listeners' => array('test'))));
         $this->handler->expects($this->once())
             ->method('notifyListeners')
             ->with(array('listeners' => array('test')));