From: Gunnar Wrobel
Date: Wed, 4 Nov 2009 23:02:04 +0000 (+0100)
Subject: Add another hierarchy level for decorators to indicate their function.
X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f6bf80b4466259bcf14e007a3b1f9833b89baa12;p=horde.git
Add another hierarchy level for decorators to indicate their function.
---
diff --git a/framework/Notification/lib/Horde/Notification.php b/framework/Notification/lib/Horde/Notification.php
index 07e2d1c52..e1f582fa1 100644
--- a/framework/Notification/lib/Horde/Notification.php
+++ b/framework/Notification/lib/Horde/Notification.php
@@ -38,9 +38,9 @@ class Horde_Notification
$storage = new Horde_Notification_Storage_Session($stack);
$handler = new Horde_Notification_Handler_Base($storage);
- $handler = new Horde_Notification_Handler_Hordelog($handler);
+ $handler = new Horde_Notification_Handler_Decorator_Hordelog($handler);
if (!empty($GLOBALS['conf']['alarms']['driver'])) {
- $handler = new Horde_Notification_Handler_Alarm(
+ $handler = new Horde_Notification_Handler_Decorator_Alarm(
$handler, Horde_Alarm::factory()
);
}
diff --git a/framework/Notification/lib/Horde/Notification/Handler/Alarm.php b/framework/Notification/lib/Horde/Notification/Handler/Alarm.php
deleted file mode 100644
index 4b4e43de2..000000000
--- a/framework/Notification/lib/Horde/Notification/Handler/Alarm.php
+++ /dev/null
@@ -1,178 +0,0 @@
-
- * @package Horde_Notification
- */
-class Horde_Notification_Handler_Alarm
-implements Horde_Notification_Handler_Interface
-{
- /**
- * The notification handler decorated by this instance.
- *
- * @var Horde_Notification_Handler
- */
- private $_handler;
-
- /**
- * A Horde_Alarm instance.
- *
- * @var Horde_Alarm
- */
- protected $_alarm;
-
- /**
- * Initialize the notification system, set up any needed session
- * variables, etc.
- *
- * @param Horde_Notification_Handler $handler The handler this instance
- * provides with logging.
- * @param Horde_Alarm $alarm The alarm system to notify.
- */
- public function __construct(
- Horde_Notification_Handler_Interface $handler,
- Horde_Alarm $alarm
- ) {
- $this->_handler = $handler;
- $this->_alarm = $alarm;
- }
-
- /**
- * Registers a listener with the notification object and includes
- * the necessary library file dynamically.
- *
- * @param string $listener The name of the listener to attach. These
- * names must be unique; further listeners with
- * the same name will be ignored.
- * @param array $params A hash containing any additional configuration
- * or connection parameters a listener driver
- * might need.
- * @param string $class The class name from which the driver was
- * instantiated if not the default one. If given
- * you have to include the library file
- * containing this class yourself. This is useful
- * if you want the listener driver to be
- * overriden by an application's implementation.
- *
- * @return Horde_Notification_Listener The listener object.
- * @throws Horde_Exception
- */
- public function attach($listener, $params = null, $class = null)
- {
- return $this->_handler->attach($listener, $params, $class);
- }
-
- /**
- * Remove a listener from the notification list. This will discard any
- * notifications in this listeners stack.
- *
- * @param string $listner The name of the listener to detach.
- *
- * @throws Horde_Exception
- */
- public function detach($listener)
- {
- $this->_handler->detach($listener);
- }
-
- /**
- * Replaces a listener in the notification list. This preserves all
- * notifications in this listeners stack. If the listener does not exist,
- * the new listener will be added automatically.
- *
- * @param string $listener See attach().
- * @param array $params See attach().
- * @param string $class See attach().
- *
- * @return Horde_Notification_Listener See attach()
- * @throws Horde_Exception
- */
- public function replace($listener, array $params = array(), $class = null)
- {
- return $this->_handler->replace($listener, $params, $class);
- }
-
- /**
- * Add an event to the Horde message stack.
- *
- * The event type parameter should begin with 'horde.' unless the
- * application defines its own Horde_Notification_Listener subclass that
- * handles additional codes.
- *
- * @param mixed $event Horde_Notification_Event object or message string.
- * @param integer $type The type of message: 'horde.error',
- * 'horde.warning', 'horde.success', or
- * 'horde.message'.
- * @param array $flags Array of optional flags that will be passed to the
- * registered listeners.
- */
- public function push($event, $type = null, array $flags = array())
- {
- $this->_handler->push($event, $type, $flags);
- }
-
- /**
- * Passes the message stack to all listeners and asks them to
- * handle their messages.
- *
- * @param array $options An array containing display options for the
- * listeners.
- */
- public function notify(array $options = array())
- {
- $this->_handler->setNotificationListeners($options);
-
- if (in_array('status', $options['listeners'])) {
- $this->_alarm->notify(Horde_Auth::getAuth());
- }
-
- $this->_handler->notifyListeners($options);
- }
-
- /**
- * Convert the 'listeners' option into the format expected by the
- * notification handler.
- *
- * @param array $options An array containing display options for the
- * listeners.
- */
- public function setNotificationListeners(array &$options)
- {
- $this->_handler->setNotificationListeners($options);
- }
-
- /**
- * Passes the message stack to all listeners and asks them to
- * handle their messages.
- *
- * @param array $options An array containing display options for the
- * listeners. This array is required to contain the
- * correct lowercased listener names as array in the
- * entry 'listeners'.
- */
- public function notifyListeners(array $options)
- {
- $this->_handler->notifyListeners($options);
- }
-
- /**
- * Return the number of notification messages in the stack.
- *
- * @author David Ulevitch
- *
- * @param string $my_listener The name of the listener.
- *
- * @return integer The number of messages in the stack.
- */
- public function count($my_listener = null)
- {
- return $this->_handler->count($my_listener);
- }
-
-}
diff --git a/framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php
new file mode 100644
index 000000000..26d2e5a41
--- /dev/null
+++ b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php
@@ -0,0 +1,178 @@
+
+ * @package Horde_Notification
+ */
+class Horde_Notification_Handler_Decorator_Alarm
+implements Horde_Notification_Handler_Interface
+{
+ /**
+ * The notification handler decorated by this instance.
+ *
+ * @var Horde_Notification_Handler
+ */
+ private $_handler;
+
+ /**
+ * A Horde_Alarm instance.
+ *
+ * @var Horde_Alarm
+ */
+ protected $_alarm;
+
+ /**
+ * Initialize the notification system, set up any needed session
+ * variables, etc.
+ *
+ * @param Horde_Notification_Handler $handler The handler this instance
+ * provides with logging.
+ * @param Horde_Alarm $alarm The alarm system to notify.
+ */
+ public function __construct(
+ Horde_Notification_Handler_Interface $handler,
+ Horde_Alarm $alarm
+ ) {
+ $this->_handler = $handler;
+ $this->_alarm = $alarm;
+ }
+
+ /**
+ * Registers a listener with the notification object and includes
+ * the necessary library file dynamically.
+ *
+ * @param string $listener The name of the listener to attach. These
+ * names must be unique; further listeners with
+ * the same name will be ignored.
+ * @param array $params A hash containing any additional configuration
+ * or connection parameters a listener driver
+ * might need.
+ * @param string $class The class name from which the driver was
+ * instantiated if not the default one. If given
+ * you have to include the library file
+ * containing this class yourself. This is useful
+ * if you want the listener driver to be
+ * overriden by an application's implementation.
+ *
+ * @return Horde_Notification_Listener The listener object.
+ * @throws Horde_Exception
+ */
+ public function attach($listener, $params = null, $class = null)
+ {
+ return $this->_handler->attach($listener, $params, $class);
+ }
+
+ /**
+ * Remove a listener from the notification list. This will discard any
+ * notifications in this listeners stack.
+ *
+ * @param string $listner The name of the listener to detach.
+ *
+ * @throws Horde_Exception
+ */
+ public function detach($listener)
+ {
+ $this->_handler->detach($listener);
+ }
+
+ /**
+ * Replaces a listener in the notification list. This preserves all
+ * notifications in this listeners stack. If the listener does not exist,
+ * the new listener will be added automatically.
+ *
+ * @param string $listener See attach().
+ * @param array $params See attach().
+ * @param string $class See attach().
+ *
+ * @return Horde_Notification_Listener See attach()
+ * @throws Horde_Exception
+ */
+ public function replace($listener, array $params = array(), $class = null)
+ {
+ return $this->_handler->replace($listener, $params, $class);
+ }
+
+ /**
+ * Add an event to the Horde message stack.
+ *
+ * The event type parameter should begin with 'horde.' unless the
+ * application defines its own Horde_Notification_Listener subclass that
+ * handles additional codes.
+ *
+ * @param mixed $event Horde_Notification_Event object or message string.
+ * @param integer $type The type of message: 'horde.error',
+ * 'horde.warning', 'horde.success', or
+ * 'horde.message'.
+ * @param array $flags Array of optional flags that will be passed to the
+ * registered listeners.
+ */
+ public function push($event, $type = null, array $flags = array())
+ {
+ $this->_handler->push($event, $type, $flags);
+ }
+
+ /**
+ * Passes the message stack to all listeners and asks them to
+ * handle their messages.
+ *
+ * @param array $options An array containing display options for the
+ * listeners.
+ */
+ public function notify(array $options = array())
+ {
+ $this->_handler->setNotificationListeners($options);
+
+ if (in_array('status', $options['listeners'])) {
+ $this->_alarm->notify(Horde_Auth::getAuth());
+ }
+
+ $this->_handler->notifyListeners($options);
+ }
+
+ /**
+ * Convert the 'listeners' option into the format expected by the
+ * notification handler.
+ *
+ * @param array $options An array containing display options for the
+ * listeners.
+ */
+ public function setNotificationListeners(array &$options)
+ {
+ $this->_handler->setNotificationListeners($options);
+ }
+
+ /**
+ * Passes the message stack to all listeners and asks them to
+ * handle their messages.
+ *
+ * @param array $options An array containing display options for the
+ * listeners. This array is required to contain the
+ * correct lowercased listener names as array in the
+ * entry 'listeners'.
+ */
+ public function notifyListeners(array $options)
+ {
+ $this->_handler->notifyListeners($options);
+ }
+
+ /**
+ * Return the number of notification messages in the stack.
+ *
+ * @author David Ulevitch
+ *
+ * @param string $my_listener The name of the listener.
+ *
+ * @return integer The number of messages in the stack.
+ */
+ public function count($my_listener = null)
+ {
+ return $this->_handler->count($my_listener);
+ }
+
+}
diff --git a/framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php
new file mode 100644
index 000000000..5054f5f7b
--- /dev/null
+++ b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php
@@ -0,0 +1,165 @@
+
+ * @package Horde_Notification
+ */
+class Horde_Notification_Handler_Decorator_Hordelog
+implements Horde_Notification_Handler_Interface
+{
+ /**
+ * The notification handler decorated by this instance.
+ *
+ * @var Horde_Notification_Handler
+ */
+ private $_handler;
+
+ /**
+ * Initialize the notification system, set up any needed session
+ * variables, etc.
+ *
+ * @param Horde_Notification_Handler $handler The handler this instance
+ * provides with logging.
+ */
+ public function __construct(
+ Horde_Notification_Handler_Interface $handler
+ ) {
+ $this->_handler = $handler;
+ }
+
+ /**
+ * Registers a listener with the notification object and includes
+ * the necessary library file dynamically.
+ *
+ * @param string $listener The name of the listener to attach. These
+ * names must be unique; further listeners with
+ * the same name will be ignored.
+ * @param array $params A hash containing any additional configuration
+ * or connection parameters a listener driver
+ * might need.
+ * @param string $class The class name from which the driver was
+ * instantiated if not the default one. If given
+ * you have to include the library file
+ * containing this class yourself. This is useful
+ * if you want the listener driver to be
+ * overriden by an application's implementation.
+ *
+ * @return Horde_Notification_Listener The listener object.
+ * @throws Horde_Exception
+ */
+ public function attach($listener, $params = null, $class = null)
+ {
+ return $this->_handler->attach($listener, $params, $class);
+ }
+
+ /**
+ * Remove a listener from the notification list. This will discard any
+ * notifications in this listeners stack.
+ *
+ * @param string $listner The name of the listener to detach.
+ *
+ * @throws Horde_Exception
+ */
+ public function detach($listener)
+ {
+ $this->_handler->detach($listener);
+ }
+
+ /**
+ * Replaces a listener in the notification list. This preserves all
+ * notifications in this listeners stack. If the listener does not exist,
+ * the new listener will be added automatically.
+ *
+ * @param string $listener See attach().
+ * @param array $params See attach().
+ * @param string $class See attach().
+ *
+ * @return Horde_Notification_Listener See attach()
+ * @throws Horde_Exception
+ */
+ public function replace($listener, array $params = array(), $class = null)
+ {
+ return $this->_handler->replace($listener, $params, $class);
+ }
+
+ /**
+ * Add an event to the Horde message stack.
+ *
+ * The event type parameter should begin with 'horde.' unless the
+ * application defines its own Horde_Notification_Listener subclass that
+ * handles additional codes.
+ *
+ * @param mixed $event Horde_Notification_Event object or message string.
+ * @param integer $type The type of message: 'horde.error',
+ * 'horde.warning', 'horde.success', or
+ * 'horde.message'.
+ * @param array $flags Array of optional flags that will be passed to the
+ * registered listeners.
+ */
+ public function push($event, $type = null, array $flags = array())
+ {
+ if ($event instanceof PEAR_Error || $event instanceof Exception) {
+ Horde::logMessage($event, __FILE__, __LINE__, PEAR_LOG_DEBUG);
+ }
+ $this->_handler->push($event, $type, $flags);
+ }
+
+ /**
+ * Passes the message stack to all listeners and asks them to
+ * handle their messages.
+ *
+ * @param array $options An array containing display options for the
+ * listeners.
+ */
+ public function notify(array $options = array())
+ {
+ $this->_handler->notify($options);
+ }
+
+ /**
+ * Convert the 'listeners' option into the format expected by the
+ * notification handler.
+ *
+ * @param array $options An array containing display options for the
+ * listeners.
+ */
+ public function setNotificationListeners(array &$options)
+ {
+ $this->_handler->setNotificationListeners($options);
+ }
+
+ /**
+ * Passes the message stack to all listeners and asks them to
+ * handle their messages.
+ *
+ * @param array $options An array containing display options for the
+ * listeners. This array is required to contain the
+ * correct lowercased listener names as array in the
+ * entry 'listeners'.
+ */
+ public function notifyListeners(array $options)
+ {
+ $this->_handler->notifyListeners($options);
+ }
+
+ /**
+ * Return the number of notification messages in the stack.
+ *
+ * @author David Ulevitch
+ *
+ * @param string $my_listener The name of the listener.
+ *
+ * @return integer The number of messages in the stack.
+ */
+ public function count($my_listener = null)
+ {
+ return $this->_handler->count($my_listener);
+ }
+}
diff --git a/framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php
new file mode 100644
index 000000000..adf7a3c56
--- /dev/null
+++ b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php
@@ -0,0 +1,186 @@
+
+ * @package Horde_Notification
+ */
+class Horde_Notification_Handler_Decorator_Log
+implements Horde_Notification_Handler_Interface
+{
+ /**
+ * The notification handler decorated by this instance.
+ *
+ * @var Horde_Notification_Handler
+ */
+ private $_handler;
+
+ /**
+ * The log handler.
+ *
+ * @var mixed
+ */
+ private $_logger;
+
+ /**
+ * Initialize the notification system, set up any needed session
+ * variables, etc.
+ *
+ * @param Horde_Notification_Handler $handler The handler this instance
+ * provides with logging.
+ *
+ * @param mixed $logger The log handler. The provided
+ * instance is required to
+ * implement the debug() function.
+ * You should be able to use a
+ * common Logger here (PEAR Log,
+ * Horde_Log_Logger, or Zend_Log).
+ */
+ public function __construct(
+ Horde_Notification_Handler_Interface $handler,
+ $logger
+ ) {
+ $this->_handler = $handler;
+ $this->_logger = $logger;
+ }
+
+ /**
+ * Registers a listener with the notification object and includes
+ * the necessary library file dynamically.
+ *
+ * @param string $listener The name of the listener to attach. These
+ * names must be unique; further listeners with
+ * the same name will be ignored.
+ * @param array $params A hash containing any additional configuration
+ * or connection parameters a listener driver
+ * might need.
+ * @param string $class The class name from which the driver was
+ * instantiated if not the default one. If given
+ * you have to include the library file
+ * containing this class yourself. This is useful
+ * if you want the listener driver to be
+ * overriden by an application's implementation.
+ *
+ * @return Horde_Notification_Listener The listener object.
+ * @throws Horde_Exception
+ */
+ public function attach($listener, $params = null, $class = null)
+ {
+ return $this->_handler->attach($listener, $params, $class);
+ }
+
+ /**
+ * Remove a listener from the notification list. This will discard any
+ * notifications in this listeners stack.
+ *
+ * @param string $listner The name of the listener to detach.
+ *
+ * @throws Horde_Exception
+ */
+ public function detach($listener)
+ {
+ $this->_handler->detach($listener);
+ }
+
+ /**
+ * Replaces a listener in the notification list. This preserves all
+ * notifications in this listeners stack. If the listener does not exist,
+ * the new listener will be added automatically.
+ *
+ * @param string $listener See attach().
+ * @param array $params See attach().
+ * @param string $class See attach().
+ *
+ * @return Horde_Notification_Listener See attach()
+ * @throws Horde_Exception
+ */
+ public function replace($listener, array $params = array(), $class = null)
+ {
+ return $this->_handler->replace($listener, $params, $class);
+ }
+
+ /**
+ * Add an event to the Horde message stack.
+ *
+ * The event type parameter should begin with 'horde.' unless the
+ * application defines its own Horde_Notification_Listener subclass that
+ * handles additional codes.
+ *
+ * @param mixed $event Horde_Notification_Event object or message string.
+ * @param integer $type The type of message: 'horde.error',
+ * 'horde.warning', 'horde.success', or
+ * 'horde.message'.
+ * @param array $flags Array of optional flags that will be passed to the
+ * registered listeners.
+ */
+ public function push($event, $type = null, array $flags = array())
+ {
+ if ($event instanceof PEAR_Error || $event instanceof Exception) {
+ /**
+ * Some loggers only accept string messages. As both PEAR_Error and
+ * Exception accept being casted into a string we can ensure that
+ * the logger receives a string here.
+ */
+ $this->_logger->debug((string) $event);
+ }
+ $this->_handler->push($event, $type, $flags);
+ }
+
+ /**
+ * Passes the message stack to all listeners and asks them to
+ * handle their messages.
+ *
+ * @param array $options An array containing display options for the
+ * listeners.
+ */
+ public function notify(array $options = array())
+ {
+ $this->_handler->notify($options);
+ }
+
+ /**
+ * Convert the 'listeners' option into the format expected by the
+ * notification handler.
+ *
+ * @param array $options An array containing display options for the
+ * listeners.
+ */
+ public function setNotificationListeners(array &$options)
+ {
+ $this->_handler->setNotificationListeners($options);
+ }
+
+ /**
+ * Passes the message stack to all listeners and asks them to
+ * handle their messages.
+ *
+ * @param array $options An array containing display options for the
+ * listeners. This array is required to contain the
+ * correct lowercased listener names as array in the
+ * entry 'listeners'.
+ */
+ public function notifyListeners(array $options)
+ {
+ $this->_handler->notifyListeners($options);
+ }
+
+ /**
+ * Return the number of notification messages in the stack.
+ *
+ * @author David Ulevitch
+ *
+ * @param string $my_listener The name of the listener.
+ *
+ * @return integer The number of messages in the stack.
+ */
+ public function count($my_listener = null)
+ {
+ return $this->_handler->count($my_listener);
+ }
+}
diff --git a/framework/Notification/lib/Horde/Notification/Handler/Hordelog.php b/framework/Notification/lib/Horde/Notification/Handler/Hordelog.php
deleted file mode 100644
index 5558f472e..000000000
--- a/framework/Notification/lib/Horde/Notification/Handler/Hordelog.php
+++ /dev/null
@@ -1,165 +0,0 @@
-
- * @package Horde_Notification
- */
-class Horde_Notification_Handler_Hordelog
-implements Horde_Notification_Handler_Interface
-{
- /**
- * The notification handler decorated by this instance.
- *
- * @var Horde_Notification_Handler
- */
- private $_handler;
-
- /**
- * Initialize the notification system, set up any needed session
- * variables, etc.
- *
- * @param Horde_Notification_Handler $handler The handler this instance
- * provides with logging.
- */
- public function __construct(
- Horde_Notification_Handler_Interface $handler
- ) {
- $this->_handler = $handler;
- }
-
- /**
- * Registers a listener with the notification object and includes
- * the necessary library file dynamically.
- *
- * @param string $listener The name of the listener to attach. These
- * names must be unique; further listeners with
- * the same name will be ignored.
- * @param array $params A hash containing any additional configuration
- * or connection parameters a listener driver
- * might need.
- * @param string $class The class name from which the driver was
- * instantiated if not the default one. If given
- * you have to include the library file
- * containing this class yourself. This is useful
- * if you want the listener driver to be
- * overriden by an application's implementation.
- *
- * @return Horde_Notification_Listener The listener object.
- * @throws Horde_Exception
- */
- public function attach($listener, $params = null, $class = null)
- {
- return $this->_handler->attach($listener, $params, $class);
- }
-
- /**
- * Remove a listener from the notification list. This will discard any
- * notifications in this listeners stack.
- *
- * @param string $listner The name of the listener to detach.
- *
- * @throws Horde_Exception
- */
- public function detach($listener)
- {
- $this->_handler->detach($listener);
- }
-
- /**
- * Replaces a listener in the notification list. This preserves all
- * notifications in this listeners stack. If the listener does not exist,
- * the new listener will be added automatically.
- *
- * @param string $listener See attach().
- * @param array $params See attach().
- * @param string $class See attach().
- *
- * @return Horde_Notification_Listener See attach()
- * @throws Horde_Exception
- */
- public function replace($listener, array $params = array(), $class = null)
- {
- return $this->_handler->replace($listener, $params, $class);
- }
-
- /**
- * Add an event to the Horde message stack.
- *
- * The event type parameter should begin with 'horde.' unless the
- * application defines its own Horde_Notification_Listener subclass that
- * handles additional codes.
- *
- * @param mixed $event Horde_Notification_Event object or message string.
- * @param integer $type The type of message: 'horde.error',
- * 'horde.warning', 'horde.success', or
- * 'horde.message'.
- * @param array $flags Array of optional flags that will be passed to the
- * registered listeners.
- */
- public function push($event, $type = null, array $flags = array())
- {
- if ($event instanceof PEAR_Error || $event instanceof Exception) {
- Horde::logMessage($event, __FILE__, __LINE__, PEAR_LOG_DEBUG);
- }
- $this->_handler->push($event, $type, $flags);
- }
-
- /**
- * Passes the message stack to all listeners and asks them to
- * handle their messages.
- *
- * @param array $options An array containing display options for the
- * listeners.
- */
- public function notify(array $options = array())
- {
- $this->_handler->notify($options);
- }
-
- /**
- * Convert the 'listeners' option into the format expected by the
- * notification handler.
- *
- * @param array $options An array containing display options for the
- * listeners.
- */
- public function setNotificationListeners(array &$options)
- {
- $this->_handler->setNotificationListeners($options);
- }
-
- /**
- * Passes the message stack to all listeners and asks them to
- * handle their messages.
- *
- * @param array $options An array containing display options for the
- * listeners. This array is required to contain the
- * correct lowercased listener names as array in the
- * entry 'listeners'.
- */
- public function notifyListeners(array $options)
- {
- $this->_handler->notifyListeners($options);
- }
-
- /**
- * Return the number of notification messages in the stack.
- *
- * @author David Ulevitch
- *
- * @param string $my_listener The name of the listener.
- *
- * @return integer The number of messages in the stack.
- */
- public function count($my_listener = null)
- {
- return $this->_handler->count($my_listener);
- }
-}
diff --git a/framework/Notification/lib/Horde/Notification/Handler/Logged.php b/framework/Notification/lib/Horde/Notification/Handler/Logged.php
deleted file mode 100644
index fbf3e1070..000000000
--- a/framework/Notification/lib/Horde/Notification/Handler/Logged.php
+++ /dev/null
@@ -1,186 +0,0 @@
-
- * @package Horde_Notification
- */
-class Horde_Notification_Handler_Logged
-implements Horde_Notification_Handler_Interface
-{
- /**
- * The notification handler decorated by this instance.
- *
- * @var Horde_Notification_Handler
- */
- private $_handler;
-
- /**
- * The log handler.
- *
- * @var mixed
- */
- private $_logger;
-
- /**
- * Initialize the notification system, set up any needed session
- * variables, etc.
- *
- * @param Horde_Notification_Handler $handler The handler this instance
- * provides with logging.
- *
- * @param mixed $logger The log handler. The provided
- * instance is required to
- * implement the debug() function.
- * You should be able to use a
- * common Logger here (PEAR Log,
- * Horde_Log_Logger, or Zend_Log).
- */
- public function __construct(
- Horde_Notification_Handler_Interface $handler,
- $logger
- ) {
- $this->_handler = $handler;
- $this->_logger = $logger;
- }
-
- /**
- * Registers a listener with the notification object and includes
- * the necessary library file dynamically.
- *
- * @param string $listener The name of the listener to attach. These
- * names must be unique; further listeners with
- * the same name will be ignored.
- * @param array $params A hash containing any additional configuration
- * or connection parameters a listener driver
- * might need.
- * @param string $class The class name from which the driver was
- * instantiated if not the default one. If given
- * you have to include the library file
- * containing this class yourself. This is useful
- * if you want the listener driver to be
- * overriden by an application's implementation.
- *
- * @return Horde_Notification_Listener The listener object.
- * @throws Horde_Exception
- */
- public function attach($listener, $params = null, $class = null)
- {
- return $this->_handler->attach($listener, $params, $class);
- }
-
- /**
- * Remove a listener from the notification list. This will discard any
- * notifications in this listeners stack.
- *
- * @param string $listner The name of the listener to detach.
- *
- * @throws Horde_Exception
- */
- public function detach($listener)
- {
- $this->_handler->detach($listener);
- }
-
- /**
- * Replaces a listener in the notification list. This preserves all
- * notifications in this listeners stack. If the listener does not exist,
- * the new listener will be added automatically.
- *
- * @param string $listener See attach().
- * @param array $params See attach().
- * @param string $class See attach().
- *
- * @return Horde_Notification_Listener See attach()
- * @throws Horde_Exception
- */
- public function replace($listener, array $params = array(), $class = null)
- {
- return $this->_handler->replace($listener, $params, $class);
- }
-
- /**
- * Add an event to the Horde message stack.
- *
- * The event type parameter should begin with 'horde.' unless the
- * application defines its own Horde_Notification_Listener subclass that
- * handles additional codes.
- *
- * @param mixed $event Horde_Notification_Event object or message string.
- * @param integer $type The type of message: 'horde.error',
- * 'horde.warning', 'horde.success', or
- * 'horde.message'.
- * @param array $flags Array of optional flags that will be passed to the
- * registered listeners.
- */
- public function push($event, $type = null, array $flags = array())
- {
- if ($event instanceof PEAR_Error || $event instanceof Exception) {
- /**
- * Some loggers only accept string messages. As both PEAR_Error and
- * Exception accept being casted into a string we can ensure that
- * the logger receives a string here.
- */
- $this->_logger->debug((string) $event);
- }
- $this->_handler->push($event, $type, $flags);
- }
-
- /**
- * Passes the message stack to all listeners and asks them to
- * handle their messages.
- *
- * @param array $options An array containing display options for the
- * listeners.
- */
- public function notify(array $options = array())
- {
- $this->_handler->notify($options);
- }
-
- /**
- * Convert the 'listeners' option into the format expected by the
- * notification handler.
- *
- * @param array $options An array containing display options for the
- * listeners.
- */
- public function setNotificationListeners(array &$options)
- {
- $this->_handler->setNotificationListeners($options);
- }
-
- /**
- * Passes the message stack to all listeners and asks them to
- * handle their messages.
- *
- * @param array $options An array containing display options for the
- * listeners. This array is required to contain the
- * correct lowercased listener names as array in the
- * entry 'listeners'.
- */
- public function notifyListeners(array $options)
- {
- $this->_handler->notifyListeners($options);
- }
-
- /**
- * Return the number of notification messages in the stack.
- *
- * @author David Ulevitch
- *
- * @param string $my_listener The name of the listener.
- *
- * @return integer The number of messages in the stack.
- */
- public function count($my_listener = null)
- {
- return $this->_handler->count($my_listener);
- }
-}
diff --git a/framework/Notification/package.xml b/framework/Notification/package.xml
index c02fd825d..5be347f93 100644
--- a/framework/Notification/package.xml
+++ b/framework/Notification/package.xml
@@ -34,11 +34,13 @@ http://pear.php.net/dtd/package-2.0.xsd">
-
-
+
+
+
+
+
-
@@ -66,10 +68,12 @@ http://pear.php.net/dtd/package-2.0.xsd">
-
-
-
+
+
+
+
+
@@ -94,13 +98,13 @@ http://pear.php.net/dtd/package-2.0.xsd">
1.5.4
-
- gettext
-
Util
pear.horde.org
+
+ gettext
+
@@ -115,11 +119,11 @@ http://pear.php.net/dtd/package-2.0.xsd">
-
-
+
+
+
-
@@ -133,10 +137,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
-
-
-
-
+
+
+
+
diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/AlarmTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/AlarmTest.php
deleted file mode 100644
index 7261b5c5a..000000000
--- a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/AlarmTest.php
+++ /dev/null
@@ -1,138 +0,0 @@
-
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Notification
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../../Autoload.php';
-
-/**
- * Test the alarm notification handler class.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Horde
- * @package Notification
- * @author Gunnar Wrobel
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Notification
- */
-
-class Horde_Notification_Class_Notification_Handler_AlarmTest extends PHPUnit_Framework_TestCase
-{
- public function setUp()
- {
- $this->handler = $this->getMock(
- 'Horde_Notification_Handler_Base', array(), array(), '', false, false
- );
- $this->alarm = $this->getMock('Horde_Alarm');
- $this->alarm_handler = new Horde_Notification_Handler_Alarm(
- $this->handler, $this->alarm
- );
- }
-
- public function testMethodNotifyHasPostconditionThatTheAlarmSystemGotNotifiedIfTheStatusListenerShouldBeNotified()
- {
- $this->alarm->expects($this->once())
- ->method('notify')
- ->with('');
- $this->handler->expects($this->once())
- ->method('setNotificationListeners')
- ->with(array('listeners' => array('status')));
- $this->handler->expects($this->once())
- ->method('notifyListeners')
- ->with(array('listeners' => array('status')));
- $this->alarm_handler->notify(array('listeners' => array('status')));
- }
-
- public function testMethodAttachGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('attach')
- ->with('listener', array(), 'class')
- ->will($this->returnValue('instance'));
- $this->assertEquals(
- 'instance',
- $this->alarm_handler->attach('listener', array(), 'class')
- );
- }
-
- public function testMethodDetachGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('detach')
- ->with('listener');
- $this->alarm_handler->detach('listener');
- }
-
- public function testMethodReplaceGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('replace')
- ->with('listener', array(), 'class')
- ->will($this->returnValue('instance'));
- $this->assertEquals(
- 'instance',
- $this->alarm_handler->replace('listener', array(), 'class')
- );
- }
-
- public function testMethodPushGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('push')
- ->with('event', 'type', array());
- $this->alarm_handler->push('event', 'type', array());
- }
-
- public function testMethodNotifyGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('setNotificationListeners')
- ->with(array('listeners' => array('test')));
- $this->handler->expects($this->once())
- ->method('notifyListeners')
- ->with(array('listeners' => array('test')));
- $this->alarm_handler->notify(array('listeners' => array('test')));
- }
-
- public function testMethodSetnotificationlistenersGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('setNotificationListeners')
- ->with(array());
- $array = array();
- $this->alarm_handler->setNotificationListeners($array);
- }
-
- public function testMethodNotifylistenersGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('notifyListeners')
- ->with(array());
- $this->alarm_handler->notifyListeners(array());
- }
-
- public function testMethodCountGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('count')
- ->with('listener')
- ->will($this->returnValue(1));
- $this->assertEquals(1, $this->alarm_handler->count('listener'));
- }
-
-}
\ No newline at end of file
diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php
new file mode 100644
index 000000000..962e84e2c
--- /dev/null
+++ b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php
@@ -0,0 +1,139 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Notification
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../../Autoload.php';
+
+/**
+ * Test the alarm notification handler class.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package Notification
+ * @author Gunnar Wrobel
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Notification
+ */
+
+class Horde_Notification_Class_Notification_Handler_Decorator_AlarmTest
+extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $this->handler = $this->getMock(
+ 'Horde_Notification_Handler_Base', array(), array(), '', false, false
+ );
+ $this->alarm = $this->getMock('Horde_Alarm');
+ $this->alarm_handler = new Horde_Notification_Handler_Decorator_Alarm(
+ $this->handler, $this->alarm
+ );
+ }
+
+ public function testMethodNotifyHasPostconditionThatTheAlarmSystemGotNotifiedIfTheStatusListenerShouldBeNotified()
+ {
+ $this->alarm->expects($this->once())
+ ->method('notify')
+ ->with('');
+ $this->handler->expects($this->once())
+ ->method('setNotificationListeners')
+ ->with(array('listeners' => array('status')));
+ $this->handler->expects($this->once())
+ ->method('notifyListeners')
+ ->with(array('listeners' => array('status')));
+ $this->alarm_handler->notify(array('listeners' => array('status')));
+ }
+
+ public function testMethodAttachGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('attach')
+ ->with('listener', array(), 'class')
+ ->will($this->returnValue('instance'));
+ $this->assertEquals(
+ 'instance',
+ $this->alarm_handler->attach('listener', array(), 'class')
+ );
+ }
+
+ public function testMethodDetachGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('detach')
+ ->with('listener');
+ $this->alarm_handler->detach('listener');
+ }
+
+ public function testMethodReplaceGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('replace')
+ ->with('listener', array(), 'class')
+ ->will($this->returnValue('instance'));
+ $this->assertEquals(
+ 'instance',
+ $this->alarm_handler->replace('listener', array(), 'class')
+ );
+ }
+
+ public function testMethodPushGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('push')
+ ->with('event', 'type', array());
+ $this->alarm_handler->push('event', 'type', array());
+ }
+
+ public function testMethodNotifyGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('setNotificationListeners')
+ ->with(array('listeners' => array('test')));
+ $this->handler->expects($this->once())
+ ->method('notifyListeners')
+ ->with(array('listeners' => array('test')));
+ $this->alarm_handler->notify(array('listeners' => array('test')));
+ }
+
+ public function testMethodSetnotificationlistenersGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('setNotificationListeners')
+ ->with(array());
+ $array = array();
+ $this->alarm_handler->setNotificationListeners($array);
+ }
+
+ public function testMethodNotifylistenersGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('notifyListeners')
+ ->with(array());
+ $this->alarm_handler->notifyListeners(array());
+ }
+
+ public function testMethodCountGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('count')
+ ->with('listener')
+ ->will($this->returnValue(1));
+ $this->assertEquals(1, $this->alarm_handler->count('listener'));
+ }
+
+}
\ No newline at end of file
diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/HordelogTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/HordelogTest.php
new file mode 100644
index 000000000..7336f6365
--- /dev/null
+++ b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/HordelogTest.php
@@ -0,0 +1,135 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Notification
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../../Autoload.php';
+
+/**
+ * Test the notification handler class that logs to the horde log.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package Notification
+ * @author Gunnar Wrobel
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Notification
+ */
+
+class Horde_Notification_Class_Notification_Handler_Decorator_HordelogTest
+extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ @include_once 'Log.php';
+ if (!defined('PEAR_LOG_DEBUG')) {
+ $this->markTestSkipped('The PEAR_LOG_DEBUG constant is not available!');
+ }
+
+ $this->handler = $this->getMock(
+ 'Horde_Notification_Handler_Base', array(), array(), '', false, false
+ );
+ $this->logged_handler = new Horde_Notification_Handler_Decorator_Hordelog(
+ $this->handler
+ );
+ }
+
+ public function testMethodPushHasPostconditionThattheEventGotLoggedIfTheEventWasAnError()
+ {
+ $exception = new Exception('test');
+ $this->handler->expects($this->once())
+ ->method('push')
+ ->with($exception);
+ $this->logged_handler->push($exception);
+ }
+
+ public function testMethodAttachGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('attach')
+ ->with('listener', array(), 'class')
+ ->will($this->returnValue('instance'));
+ $this->assertEquals(
+ 'instance',
+ $this->logged_handler->attach('listener', array(), 'class')
+ );
+ }
+
+ public function testMethodDetachGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('detach')
+ ->with('listener');
+ $this->logged_handler->detach('listener');
+ }
+
+ public function testMethodReplaceGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('replace')
+ ->with('listener', array(), 'class')
+ ->will($this->returnValue('instance'));
+ $this->assertEquals(
+ 'instance',
+ $this->logged_handler->replace('listener', array(), 'class')
+ );
+ }
+
+ public function testMethodPushGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('push')
+ ->with('event', 'type', array());
+ $this->logged_handler->push('event', 'type', array());
+ }
+
+ public function testMethodNotifyGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('notify')
+ ->with(array('listeners' => array('test')));
+ $this->logged_handler->notify(array('listeners' => array('test')));
+ }
+
+ public function testMethodSetnotificationlistenersGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('setNotificationListeners')
+ ->with(array());
+ $array = array();
+ $this->logged_handler->setNotificationListeners($array);
+ }
+
+ public function testMethodNotifylistenersGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('notifyListeners')
+ ->with(array());
+ $this->logged_handler->notifyListeners(array());
+ }
+
+ public function testMethodCountGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('count')
+ ->with('listener')
+ ->will($this->returnValue(1));
+ $this->assertEquals(1, $this->logged_handler->count('listener'));
+ }
+
+}
\ No newline at end of file
diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/LogTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/LogTest.php
new file mode 100644
index 000000000..841e7fac7
--- /dev/null
+++ b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/LogTest.php
@@ -0,0 +1,134 @@
+
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Notification
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../../Autoload.php';
+
+/**
+ * Test the logging notification handler class.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package Notification
+ * @author Gunnar Wrobel
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Notification
+ */
+
+class Horde_Notification_Class_Notification_Handler_Decorator_LogTest
+extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $this->handler = $this->getMock(
+ 'Horde_Notification_Handler_Base', array(), array(), '', false, false
+ );
+ $this->logger = $this->getMock('Horde_Log_Logger');
+ $this->logged_handler = new Horde_Notification_Handler_Decorator_Log(
+ $this->handler, $this->logger
+ );
+ }
+
+ public function testMethodPushHasPostconditionThattheEventGotLoggedIfTheEventWasAnError()
+ {
+ $exception = new Exception('test');
+ $this->logger->expects($this->once())
+ ->method('__call')
+ ->with('debug', $this->isType('array'));
+ $this->handler->expects($this->once())
+ ->method('push')
+ ->with($exception);
+ $this->logged_handler->push($exception);
+ }
+
+ public function testMethodAttachGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('attach')
+ ->with('listener', array(), 'class')
+ ->will($this->returnValue('instance'));
+ $this->assertEquals(
+ 'instance',
+ $this->logged_handler->attach('listener', array(), 'class')
+ );
+ }
+
+ public function testMethodDetachGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('detach')
+ ->with('listener');
+ $this->logged_handler->detach('listener');
+ }
+
+ public function testMethodReplaceGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('replace')
+ ->with('listener', array(), 'class')
+ ->will($this->returnValue('instance'));
+ $this->assertEquals(
+ 'instance',
+ $this->logged_handler->replace('listener', array(), 'class')
+ );
+ }
+
+ public function testMethodPushGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('push')
+ ->with('event', 'type', array());
+ $this->logged_handler->push('event', 'type', array());
+ }
+
+ public function testMethodNotifyGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('notify')
+ ->with(array('listeners' => array('test')));
+ $this->logged_handler->notify(array('listeners' => array('test')));
+ }
+
+ public function testMethodSetnotificationlistenersGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('setNotificationListeners')
+ ->with(array());
+ $array = array();
+ $this->logged_handler->setNotificationListeners($array);
+ }
+
+ public function testMethodNotifylistenersGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('notifyListeners')
+ ->with(array());
+ $this->logged_handler->notifyListeners(array());
+ }
+
+ public function testMethodCountGetsDelegated()
+ {
+ $this->handler->expects($this->once())
+ ->method('count')
+ ->with('listener')
+ ->will($this->returnValue(1));
+ $this->assertEquals(1, $this->logged_handler->count('listener'));
+ }
+
+}
\ No newline at end of file
diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/HordelogTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/HordelogTest.php
deleted file mode 100644
index 77bd66cc3..000000000
--- a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/HordelogTest.php
+++ /dev/null
@@ -1,134 +0,0 @@
-
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Notification
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../../Autoload.php';
-
-/**
- * Test the notification handler class that logs to the horde log.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Horde
- * @package Notification
- * @author Gunnar Wrobel
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Notification
- */
-
-class Horde_Notification_Class_Notification_Handler_HordelogTest extends PHPUnit_Framework_TestCase
-{
- public function setUp()
- {
- @include_once 'Log.php';
- if (!defined('PEAR_LOG_DEBUG')) {
- $this->markTestSkipped('The PEAR_LOG_DEBUG constant is not available!');
- }
-
- $this->handler = $this->getMock(
- 'Horde_Notification_Handler_Base', array(), array(), '', false, false
- );
- $this->logged_handler = new Horde_Notification_Handler_Hordelog(
- $this->handler
- );
- }
-
- public function testMethodPushHasPostconditionThattheEventGotLoggedIfTheEventWasAnError()
- {
- $exception = new Exception('test');
- $this->handler->expects($this->once())
- ->method('push')
- ->with($exception);
- $this->logged_handler->push($exception);
- }
-
- public function testMethodAttachGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('attach')
- ->with('listener', array(), 'class')
- ->will($this->returnValue('instance'));
- $this->assertEquals(
- 'instance',
- $this->logged_handler->attach('listener', array(), 'class')
- );
- }
-
- public function testMethodDetachGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('detach')
- ->with('listener');
- $this->logged_handler->detach('listener');
- }
-
- public function testMethodReplaceGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('replace')
- ->with('listener', array(), 'class')
- ->will($this->returnValue('instance'));
- $this->assertEquals(
- 'instance',
- $this->logged_handler->replace('listener', array(), 'class')
- );
- }
-
- public function testMethodPushGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('push')
- ->with('event', 'type', array());
- $this->logged_handler->push('event', 'type', array());
- }
-
- public function testMethodNotifyGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('notify')
- ->with(array('listeners' => array('test')));
- $this->logged_handler->notify(array('listeners' => array('test')));
- }
-
- public function testMethodSetnotificationlistenersGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('setNotificationListeners')
- ->with(array());
- $array = array();
- $this->logged_handler->setNotificationListeners($array);
- }
-
- public function testMethodNotifylistenersGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('notifyListeners')
- ->with(array());
- $this->logged_handler->notifyListeners(array());
- }
-
- public function testMethodCountGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('count')
- ->with('listener')
- ->will($this->returnValue(1));
- $this->assertEquals(1, $this->logged_handler->count('listener'));
- }
-
-}
\ No newline at end of file
diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/LoggedTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/LoggedTest.php
deleted file mode 100644
index 2b56cd6c9..000000000
--- a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/LoggedTest.php
+++ /dev/null
@@ -1,133 +0,0 @@
-
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Notification
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../../Autoload.php';
-
-/**
- * Test the logging notification handler class.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Horde
- * @package Notification
- * @author Gunnar Wrobel
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Notification
- */
-
-class Horde_Notification_Class_Notification_Handler_LoggedTest extends PHPUnit_Framework_TestCase
-{
- public function setUp()
- {
- $this->handler = $this->getMock(
- 'Horde_Notification_Handler_Base', array(), array(), '', false, false
- );
- $this->logger = $this->getMock('Horde_Log_Logger');
- $this->logged_handler = new Horde_Notification_Handler_Logged(
- $this->handler, $this->logger
- );
- }
-
- public function testMethodPushHasPostconditionThattheEventGotLoggedIfTheEventWasAnError()
- {
- $exception = new Exception('test');
- $this->logger->expects($this->once())
- ->method('__call')
- ->with('debug', $this->isType('array'));
- $this->handler->expects($this->once())
- ->method('push')
- ->with($exception);
- $this->logged_handler->push($exception);
- }
-
- public function testMethodAttachGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('attach')
- ->with('listener', array(), 'class')
- ->will($this->returnValue('instance'));
- $this->assertEquals(
- 'instance',
- $this->logged_handler->attach('listener', array(), 'class')
- );
- }
-
- public function testMethodDetachGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('detach')
- ->with('listener');
- $this->logged_handler->detach('listener');
- }
-
- public function testMethodReplaceGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('replace')
- ->with('listener', array(), 'class')
- ->will($this->returnValue('instance'));
- $this->assertEquals(
- 'instance',
- $this->logged_handler->replace('listener', array(), 'class')
- );
- }
-
- public function testMethodPushGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('push')
- ->with('event', 'type', array());
- $this->logged_handler->push('event', 'type', array());
- }
-
- public function testMethodNotifyGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('notify')
- ->with(array('listeners' => array('test')));
- $this->logged_handler->notify(array('listeners' => array('test')));
- }
-
- public function testMethodSetnotificationlistenersGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('setNotificationListeners')
- ->with(array());
- $array = array();
- $this->logged_handler->setNotificationListeners($array);
- }
-
- public function testMethodNotifylistenersGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('notifyListeners')
- ->with(array());
- $this->logged_handler->notifyListeners(array());
- }
-
- public function testMethodCountGetsDelegated()
- {
- $this->handler->expects($this->once())
- ->method('count')
- ->with('listener')
- ->will($this->returnValue(1));
- $this->assertEquals(1, $this->logged_handler->count('listener'));
- }
-
-}
\ No newline at end of file
diff --git a/framework/Notification/test/Horde/Notification/Class/NotificationTest.php b/framework/Notification/test/Horde/Notification/Class/NotificationTest.php
index 2a8c5921a..59791a0f6 100644
--- a/framework/Notification/test/Horde/Notification/Class/NotificationTest.php
+++ b/framework/Notification/test/Horde/Notification/Class/NotificationTest.php
@@ -46,7 +46,7 @@ class Horde_Notification_Class_NotificationTest extends PHPUnit_Framework_TestCa
$conf['alarms']['driver'] = 'Mock';
$this->assertType(
- 'Horde_Notification_Handler_Alarm',
+ 'Horde_Notification_Handler_Decorator_Alarm',
Horde_Notification::singleton('alarm')
);
}