From f6bf80b4466259bcf14e007a3b1f9833b89baa12 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Thu, 5 Nov 2009 00:02:04 +0100 Subject: [PATCH] Add another hierarchy level for decorators to indicate their function. --- framework/Notification/lib/Horde/Notification.php | 4 +-- .../Notification/Handler/{ => Decorator}/Alarm.php | 2 +- .../Handler/{ => Decorator}/Hordelog.php | 2 +- .../Handler/{Logged.php => Decorator/Log.php} | 2 +- framework/Notification/package.xml | 36 ++++++++++++---------- .../Handler/{ => Decorator}/AlarmTest.php | 7 +++-- .../Handler/{ => Decorator}/HordelogTest.php | 7 +++-- .../{LoggedTest.php => Decorator/LogTest.php} | 7 +++-- .../Horde/Notification/Class/NotificationTest.php | 2 +- 9 files changed, 38 insertions(+), 31 deletions(-) rename framework/Notification/lib/Horde/Notification/Handler/{ => Decorator}/Alarm.php (99%) rename framework/Notification/lib/Horde/Notification/Handler/{ => Decorator}/Hordelog.php (99%) rename framework/Notification/lib/Horde/Notification/Handler/{Logged.php => Decorator/Log.php} (99%) rename framework/Notification/test/Horde/Notification/Class/Notification/Handler/{ => Decorator}/AlarmTest.php (94%) rename framework/Notification/test/Horde/Notification/Class/Notification/Handler/{ => Decorator}/HordelogTest.php (93%) rename framework/Notification/test/Horde/Notification/Class/Notification/Handler/{LoggedTest.php => Decorator/LogTest.php} (94%) 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/Decorator/Alarm.php similarity index 99% rename from framework/Notification/lib/Horde/Notification/Handler/Alarm.php rename to framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php index 4b4e43de2..26d2e5a41 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Alarm.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Alarm.php @@ -10,7 +10,7 @@ * @author Jan Schneider * @package Horde_Notification */ -class Horde_Notification_Handler_Alarm +class Horde_Notification_Handler_Decorator_Alarm implements Horde_Notification_Handler_Interface { /** diff --git a/framework/Notification/lib/Horde/Notification/Handler/Hordelog.php b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php similarity index 99% rename from framework/Notification/lib/Horde/Notification/Handler/Hordelog.php rename to framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php index 5558f472e..5054f5f7b 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Hordelog.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Hordelog.php @@ -11,7 +11,7 @@ * @author Jan Schneider * @package Horde_Notification */ -class Horde_Notification_Handler_Hordelog +class Horde_Notification_Handler_Decorator_Hordelog implements Horde_Notification_Handler_Interface { /** diff --git a/framework/Notification/lib/Horde/Notification/Handler/Logged.php b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php similarity index 99% rename from framework/Notification/lib/Horde/Notification/Handler/Logged.php rename to framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php index fbf3e1070..adf7a3c56 100644 --- a/framework/Notification/lib/Horde/Notification/Handler/Logged.php +++ b/framework/Notification/lib/Horde/Notification/Handler/Decorator/Log.php @@ -11,7 +11,7 @@ * @author Jan Schneider * @package Horde_Notification */ -class Horde_Notification_Handler_Logged +class Horde_Notification_Handler_Decorator_Log implements Horde_Notification_Handler_Interface { /** 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/Decorator/AlarmTest.php similarity index 94% rename from framework/Notification/test/Horde/Notification/Class/Notification/Handler/AlarmTest.php rename to framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php index 7261b5c5a..962e84e2c 100644 --- a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/AlarmTest.php +++ b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/AlarmTest.php @@ -14,7 +14,7 @@ /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/../../../Autoload.php'; +require_once dirname(__FILE__) . '/../../../../Autoload.php'; /** * Test the alarm notification handler class. @@ -31,7 +31,8 @@ require_once dirname(__FILE__) . '/../../../Autoload.php'; * @link http://pear.horde.org/index.php?package=Notification */ -class Horde_Notification_Class_Notification_Handler_AlarmTest extends PHPUnit_Framework_TestCase +class Horde_Notification_Class_Notification_Handler_Decorator_AlarmTest +extends PHPUnit_Framework_TestCase { public function setUp() { @@ -39,7 +40,7 @@ class Horde_Notification_Class_Notification_Handler_AlarmTest extends PHPUnit_Fr 'Horde_Notification_Handler_Base', array(), array(), '', false, false ); $this->alarm = $this->getMock('Horde_Alarm'); - $this->alarm_handler = new Horde_Notification_Handler_Alarm( + $this->alarm_handler = new Horde_Notification_Handler_Decorator_Alarm( $this->handler, $this->alarm ); } diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/HordelogTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/HordelogTest.php similarity index 93% rename from framework/Notification/test/Horde/Notification/Class/Notification/Handler/HordelogTest.php rename to framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/HordelogTest.php index 77bd66cc3..7336f6365 100644 --- a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/HordelogTest.php +++ b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/HordelogTest.php @@ -14,7 +14,7 @@ /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/../../../Autoload.php'; +require_once dirname(__FILE__) . '/../../../../Autoload.php'; /** * Test the notification handler class that logs to the horde log. @@ -31,7 +31,8 @@ require_once dirname(__FILE__) . '/../../../Autoload.php'; * @link http://pear.horde.org/index.php?package=Notification */ -class Horde_Notification_Class_Notification_Handler_HordelogTest extends PHPUnit_Framework_TestCase +class Horde_Notification_Class_Notification_Handler_Decorator_HordelogTest +extends PHPUnit_Framework_TestCase { public function setUp() { @@ -43,7 +44,7 @@ class Horde_Notification_Class_Notification_Handler_HordelogTest extends PHPUnit $this->handler = $this->getMock( 'Horde_Notification_Handler_Base', array(), array(), '', false, false ); - $this->logged_handler = new Horde_Notification_Handler_Hordelog( + $this->logged_handler = new Horde_Notification_Handler_Decorator_Hordelog( $this->handler ); } diff --git a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/LoggedTest.php b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/LogTest.php similarity index 94% rename from framework/Notification/test/Horde/Notification/Class/Notification/Handler/LoggedTest.php rename to framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/LogTest.php index 2b56cd6c9..841e7fac7 100644 --- a/framework/Notification/test/Horde/Notification/Class/Notification/Handler/LoggedTest.php +++ b/framework/Notification/test/Horde/Notification/Class/Notification/Handler/Decorator/LogTest.php @@ -14,7 +14,7 @@ /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/../../../Autoload.php'; +require_once dirname(__FILE__) . '/../../../../Autoload.php'; /** * Test the logging notification handler class. @@ -31,7 +31,8 @@ require_once dirname(__FILE__) . '/../../../Autoload.php'; * @link http://pear.horde.org/index.php?package=Notification */ -class Horde_Notification_Class_Notification_Handler_LoggedTest extends PHPUnit_Framework_TestCase +class Horde_Notification_Class_Notification_Handler_Decorator_LogTest +extends PHPUnit_Framework_TestCase { public function setUp() { @@ -39,7 +40,7 @@ class Horde_Notification_Class_Notification_Handler_LoggedTest extends PHPUnit_F 'Horde_Notification_Handler_Base', array(), array(), '', false, false ); $this->logger = $this->getMock('Horde_Log_Logger'); - $this->logged_handler = new Horde_Notification_Handler_Logged( + $this->logged_handler = new Horde_Notification_Handler_Decorator_Log( $this->handler, $this->logger ); } 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') ); } -- 2.11.0