From 8c970f8b665cdecab5ee1664e82141e9cf1bbd21 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Thu, 5 Nov 2009 23:35:50 +0100 Subject: [PATCH] Rename interfaces and decorators. --- .../lib/Horde/Kolab/Session/Auth/Horde.php | 3 +- .../Kolab/Session/{Auth.php => Auth/Interface.php} | 2 +- .../lib/Horde/Kolab/Session/Auth/Mock.php | 3 +- .../Kolab_Session/lib/Horde/Kolab/Session/Base.php | 2 +- .../Kolab/Session/{ => Decorator}/Anonymous.php | 20 +++--- .../Horde/Kolab/Session/{ => Decorator}/Logged.php | 15 ++-- .../Horde/Kolab/Session/{ => Decorator}/Stored.php | 13 ++-- .../lib/Horde/Kolab/Session/Factory/Base.php | 21 +++--- .../Horde/Kolab/Session/Factory/Configuration.php | 12 ++-- .../Horde/Kolab/Session/Factory/Constructor.php | 31 +++++---- .../Session/Factory/{ => Decorator}/Anonymous.php | 54 ++++++++------- .../Session/Factory/{ => Decorator}/Logged.php | 59 +++++++++------- .../Session/{Factory.php => Factory/Interface.php} | 34 +++++---- .../Kolab/{Session.php => Session/Interface.php} | 2 +- .../Session/{Storage.php => Storage/Interface.php} | 4 +- .../lib/Horde/Kolab/Session/Storage/Mock.php | 6 +- .../Horde/Kolab/Session/Storage/Sessionobjects.php | 6 +- .../lib/Horde/Kolab/Session/Valid/Base.php | 23 ++++--- .../Kolab/Session/Valid/{ => Decorator}/Logged.php | 21 +++--- .../Session/{Valid.php => Valid/Interface.php} | 8 ++- framework/Kolab_Session/package.xml | 80 +++++++++++++--------- .../Class/{ => Decorator}/AnonymousTest.php | 49 ++++++------- .../Session/Class/{ => Decorator}/LoggedTest.php | 61 ++++++++++------- .../Session/Class/{ => Decorator}/StoredTest.php | 47 ++++++------- .../Horde/Kolab/Session/Class/Factory/BaseTest.php | 14 ++-- .../Session/Class/Factory/ConfigurationTest.php | 26 +++---- .../Session/Class/Factory/ConstructorTest.php | 4 +- .../Factory/{ => Decorator}/AnonymousTest.php | 71 +++++++++---------- .../Class/Factory/{ => Decorator}/LoggedTest.php | 75 ++++++++++---------- .../Kolab/Session/Class/Factory/DefaultTest.php | 4 +- .../Kolab/Session/Class/Factory/InjectorTest.php | 4 +- .../Horde/Kolab/Session/Class/Storage/MockTest.php | 2 +- .../Session/Class/Storage/SessionobjectsTest.php | 4 +- .../Horde/Kolab/Session/Class/Valid/BaseTest.php | 24 +++---- .../Class/Valid/{ => Decorator}/LoggedTest.php | 31 +++++---- .../Kolab/Session/Integration/AnonymousTest.php | 2 +- .../Kolab/Session/Integration/SessionTest.php | 53 +++++++++----- .../Kolab/Session/Integration/SingletonTest.php | 2 +- .../Horde/Kolab/Session/Integration/ValidTest.php | 12 ++-- .../test/Horde/Kolab/Session/SessionTestCase.php | 6 +- 40 files changed, 500 insertions(+), 410 deletions(-) rename framework/Kolab_Session/lib/Horde/Kolab/Session/{Auth.php => Auth/Interface.php} (95%) rename framework/Kolab_Session/lib/Horde/Kolab/Session/{ => Decorator}/Anonymous.php (87%) rename framework/Kolab_Session/lib/Horde/Kolab/Session/{ => Decorator}/Logged.php (90%) rename framework/Kolab_Session/lib/Horde/Kolab/Session/{ => Decorator}/Stored.php (90%) rename framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/{ => Decorator}/Anonymous.php (64%) rename framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/{ => Decorator}/Logged.php (62%) rename framework/Kolab_Session/lib/Horde/Kolab/Session/{Factory.php => Factory/Interface.php} (65%) rename framework/Kolab_Session/lib/Horde/Kolab/{Session.php => Session/Interface.php} (98%) rename framework/Kolab_Session/lib/Horde/Kolab/Session/{Storage.php => Storage/Interface.php} (91%) rename framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/{ => Decorator}/Logged.php (80%) rename framework/Kolab_Session/lib/Horde/Kolab/Session/{Valid.php => Valid/Interface.php} (87%) rename framework/Kolab_Session/test/Horde/Kolab/Session/Class/{ => Decorator}/AnonymousTest.php (71%) rename framework/Kolab_Session/test/Horde/Kolab/Session/Class/{ => Decorator}/LoggedTest.php (65%) rename framework/Kolab_Session/test/Horde/Kolab/Session/Class/{ => Decorator}/StoredTest.php (63%) rename framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/{ => Decorator}/AnonymousTest.php (59%) rename framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/{ => Decorator}/LoggedTest.php (62%) rename framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/{ => Decorator}/LoggedTest.php (69%) diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Horde.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Horde.php index 31d0901ae..8401d7445 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Horde.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Horde.php @@ -25,7 +25,8 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Auth_Horde implements Horde_Kolab_Session_Auth +class Horde_Kolab_Session_Auth_Horde +implements Horde_Kolab_Session_Auth_Interface { /** * Get the current user ID. diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Interface.php similarity index 95% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Auth.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Interface.php index 1f0ab1fff..46a64bda3 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Interface.php @@ -25,7 +25,7 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -interface Horde_Kolab_Session_Auth +interface Horde_Kolab_Session_Auth_Interface { /** * Get the current user ID. diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Mock.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Mock.php index bf0893652..bc39dc43f 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Mock.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Mock.php @@ -25,7 +25,8 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Auth_Mock implements Horde_Kolab_Session_Auth +class Horde_Kolab_Session_Auth_Mock +implements Horde_Kolab_Session_Auth_Interface { /** * The user this instance will report. diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php index f9b82303d..1aeb63e56 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php @@ -31,7 +31,7 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Base implements Horde_Kolab_Session +class Horde_Kolab_Session_Base implements Horde_Kolab_Session_Interface { /** * Kolab configuration parameters. diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Anonymous.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php similarity index 87% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Anonymous.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php index 9c046a6b2..75ba38a43 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Anonymous.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php @@ -33,12 +33,13 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Anonymous implements Horde_Kolab_Session +class Horde_Kolab_Session_Decorator_Anonymous +implements Horde_Kolab_Session_Interface { /** * The session handler this instance provides with anonymous access. * - * @var Horde_Kolab_Session + * @var Horde_Kolab_Session_Interface */ private $_session; @@ -59,13 +60,16 @@ class Horde_Kolab_Session_Anonymous implements Horde_Kolab_Session /** * Constructor. * - * @param Horde_Kolab_Session $session The this instance should provide - * anonymous access for. - * @param string $user ID of the anonymous user. - * @param string $pass Password of the anonymous user. + * @param Horde_Kolab_Session_Interface $session The this instance should provide + * anonymous access for. + * @param string $user ID of the anonymous user. + * @param string $pass Password of the anonymous user. */ - public function __construct(Horde_Kolab_Session $session, $user, $pass) - { + public function __construct( + Horde_Kolab_Session_Interface $session, + $user, + $pass + ) { $this->_session = $session; $this->_anonymous_id = $user; $this->_anonymous_pass = $pass; diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Logged.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php similarity index 90% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Logged.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php index bba8424bd..10310f600 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Logged.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php @@ -25,12 +25,13 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Logged implements Horde_Kolab_Session +class Horde_Kolab_Session_Decorator_Logged +implements Horde_Kolab_Session_Interface { /** * The session handler. * - * @var Horde_Kolab_Session + * @var Horde_Kolab_Session_Interface */ private $_session; @@ -47,11 +48,13 @@ class Horde_Kolab_Session_Logged implements Horde_Kolab_Session * The provided logger class needs to implement the methods info() and * err(). * - * @param Horde_Kolab_Session $session The session handler. - * @param mixed $logger The logger instance. + * @param Horde_Kolab_Session_Interface $session The session handler. + * @param mixed $logger The logger instance. */ - public function __construct(Horde_Kolab_Session $session, $logger) - { + public function __construct( + Horde_Kolab_Session_Interface $session, + $logger + ) { $this->_session = $session; $this->_logger = $logger; } diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Stored.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php similarity index 90% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Stored.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php index c1455908f..134a3e20a 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Stored.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php @@ -25,12 +25,13 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Stored implements Horde_Kolab_Session +class Horde_Kolab_Session_Decorator_Stored +implements Horde_Kolab_Session_Interface { /** * The session handler. * - * @var Horde_Kolab_Session + * @var Horde_Kolab_Session_Interface */ private $_session; @@ -51,12 +52,12 @@ class Horde_Kolab_Session_Stored implements Horde_Kolab_Session /** * Constructor. * - * @param Horde_Kolab_Session $session The session handler. - * @param Horde_Kolab_Session_Storage $storage Store the session here. + * @param Horde_Kolab_Session_Interface $session The session handler. + * @param Horde_Kolab_Session_Storage $storage Store the session here. */ public function __construct( - Horde_Kolab_Session $session, - Horde_Kolab_Session_Storage $storage + Horde_Kolab_Session_Interface $session, + Horde_Kolab_Session_Storage_Interface $storage ) { $this->_session = $session; $this->_storage = $storage; diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Base.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Base.php index e9951070f..2ddf23075 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Base.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Base.php @@ -28,19 +28,20 @@ * @link http://pear.horde.org/index.php?package=Kolab_Session */ abstract class Horde_Kolab_Session_Factory_Base -implements Horde_Kolab_Session_Factory +implements Horde_Kolab_Session_Factory_Interface { /** * Return the session validation driver. * - * @param Horde_Kolab_Session $session The session to validate. - * @param Horde_Kolab_Session_Auth $auth The auth handler. + * @param Horde_Kolab_Session_Interface $session The session to validate. + * @param Horde_Kolab_Session_Auth_Interface $auth The auth handler. * - * @return Horde_Kolab_Session_Valid The driver for validating sessions. + * @return Horde_Kolab_Session_Valid_Interface The driver for validating + * sessions. */ public function getSessionValidator( - Horde_Kolab_Session $session, - Horde_Kolab_Session_Auth $auth + Horde_Kolab_Session_Interface $session, + Horde_Kolab_Session_Auth_Interface $auth ) { $validator = new Horde_Kolab_Session_Valid_Base( $session, $auth @@ -57,8 +58,10 @@ implements Horde_Kolab_Session_Factory * * @return boolean True if the given session is valid. */ - public function validate(Horde_Kolab_Session $session, $user = null) - { + public function validate( + Horde_Kolab_Session_Interface $session, + $user = null + ) { return $this->getSessionValidator( $session, $this->getSessionAuth() @@ -80,7 +83,7 @@ implements Horde_Kolab_Session_Factory $this->getSessionConfiguration() ); /** If we created a new session handler it needs to be stored once */ - $session = new Horde_Kolab_Session_Stored( + $session = new Horde_Kolab_Session_Decorator_Stored( $session, $this->getSessionStorage() ); diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Configuration.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Configuration.php index 8fa9930ab..0869ee34a 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Configuration.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Configuration.php @@ -26,7 +26,7 @@ * @link http://pear.horde.org/index.php?package=Kolab_Session */ class Horde_Kolab_Session_Factory_Configuration -implements Horde_Kolab_Session_Factory +implements Horde_Kolab_Session_Factory_Interface { /** * Configuration parameters for the session. @@ -70,7 +70,7 @@ implements Horde_Kolab_Session_Factory ); if (isset($config['logger'])) { - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $config['logger'] ); } @@ -78,7 +78,7 @@ implements Horde_Kolab_Session_Factory if (isset($config['session']['anonymous']['user']) && isset($config['session']['anonymous']['pass']) ) { - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, $config['session']['anonymous']['user'], $config['session']['anonymous']['pass'] @@ -137,8 +137,8 @@ implements Horde_Kolab_Session_Factory * @return Horde_Kolab_Session_Valid The driver for validating sessions. */ public function getSessionValidator( - Horde_Kolab_Session $session, - Horde_Kolab_Session_Auth $auth + Horde_Kolab_Session_Interface $session, + Horde_Kolab_Session_Auth_Interface $auth ) { return $this->_factory->getSessionValidator($session, $auth); } @@ -152,7 +152,7 @@ implements Horde_Kolab_Session_Factory * * @return boolean True if the given session is valid. */ - public function validate(Horde_Kolab_Session $session, $user = null) + public function validate(Horde_Kolab_Session_Interface $session, $user = null) { return $this->_factory->validate($session, $user); } diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Constructor.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Constructor.php index df50a24b5..22fd5aac2 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Constructor.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Constructor.php @@ -31,14 +31,14 @@ extends Horde_Kolab_Session_Factory_Base /** * The connection to the Kolab user db. * - * @var Horde_Kolab_Server_Composite + * @var Horde_Kolab_Server_Composite_Interface */ private $_server; /** * The auth handler for the session. * - * @var Horde_Kolab_Session_Auth + * @var Horde_Kolab_Session_Auth_Interface */ private $_auth; @@ -52,27 +52,28 @@ extends Horde_Kolab_Session_Factory_Base /** * The storage handler for the session. * - * @var Horde_Kolab_Session_Storage + * @var Horde_Kolab_Session_Storage_Interface */ private $_storage; /** * Constructor. * - * @param Horde_Kolab_Server_Composite $server The connection to the Kolab - * user db. - * @param Horde_Kolab_Session_Auth $auth The auth handler for the - * session. - * @param array $config Configuration parameters for - * the session. - * @param Horde_Kolab_Session_Storage $storage The storage handler for the - * session. + * @param Horde_Kolab_Server_Composite_Interface $server The connection to the + * Kolab user db. + * @param Horde_Kolab_Session_Auth_Interface $auth The auth handler for + * the session. + * @param array $config Configuration + * parameters for the + * session. + * @param Horde_Kolab_Session_Storage_Interface $storage The storage handler + * for the session. */ public function __construct( Horde_Kolab_Server_Composite_Interface $server, - Horde_Kolab_Session_Auth $auth, + Horde_Kolab_Session_Auth_Interface $auth, array $config, - Horde_Kolab_Session_Storage $storage + Horde_Kolab_Session_Storage_Interface $storage ) { $this->_server = $server; $this->_auth = $auth; @@ -93,7 +94,7 @@ extends Horde_Kolab_Session_Factory_Base /** * Return the auth handler for sessions. * - * @return Horde_Kolab_Session_Auth The authentication handler. + * @return Horde_Kolab_Session_Auth_Interface The authentication handler. */ public function getSessionAuth() { @@ -113,7 +114,7 @@ extends Horde_Kolab_Session_Factory_Base /** * Return the session storage driver. * - * @return Horde_Kolab_Session_Storage The driver for storing sessions. + * @return Horde_Kolab_Session_Storage_Interface The driver for storing sessions. */ public function getSessionStorage() { diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Anonymous.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Anonymous.php similarity index 64% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Anonymous.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Anonymous.php index 85f5081ca..6dabf789e 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Anonymous.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Anonymous.php @@ -25,13 +25,13 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Factory_Anonymous -implements Horde_Kolab_Session_Factory +class Horde_Kolab_Session_Factory_Decorator_Anonymous +implements Horde_Kolab_Session_Factory_Interface { /** * The factory setup resulting from the configuration. * - * @var Horde_Kolab_Session_Factory + * @var Horde_Kolab_Session_Factory_Interface */ private $_factory; @@ -52,13 +52,14 @@ implements Horde_Kolab_Session_Factory /** * Constructor. * - * @param Horde_Kolab_Session_Factory $factory The base factory. - * @param string $user ID of the anonymous user. - * @param string $pass Password of the anonymous - * user. + * @param Horde_Kolab_Session_Factory_Interface $factory The base factory. + * @param string $user ID of the anonymous + * user. + * @param string $pass Password of the + * anonymous user. */ public function __construct( - Horde_Kolab_Session_Factory $factory, + Horde_Kolab_Session_Factory_Interface $factory, $user, $pass ) { @@ -70,7 +71,7 @@ implements Horde_Kolab_Session_Factory /** * Return the kolab user db connection. * - * @return Horde_Kolab_Server The server connection. + * @return Horde_Kolab_Server_Interface The server connection. */ public function getServer() { @@ -80,7 +81,7 @@ implements Horde_Kolab_Session_Factory /** * Return the auth handler for sessions. * - * @return Horde_Kolab_Session_Auth The authentication handler. + * @return Horde_Kolab_Session_Auth_Interface The authentication handler. */ public function getSessionAuth() { @@ -100,7 +101,7 @@ implements Horde_Kolab_Session_Factory /** * Return the session storage driver. * - * @return Horde_Kolab_Session_Storage The driver for storing sessions. + * @return Horde_Kolab_Session_Storage_Interface The driver for storing sessions. */ public function getSessionStorage() { @@ -110,14 +111,15 @@ implements Horde_Kolab_Session_Factory /** * Return the session validation driver. * - * @param Horde_Kolab_Session $session The session to validate. - * @param Horde_Kolab_Session_Auth $auth The auth handler. + * @param Horde_Kolab_Session_Interface $session The session to validate. + * @param Horde_Kolab_Session_Auth_Interface $auth The auth handler. * - * @return Horde_Kolab_Session_Valid The driver for validating sessions. + * @return Horde_Kolab_Session_Valid_Interface The driver for validating + * sessions. */ public function getSessionValidator( - Horde_Kolab_Session $session, - Horde_Kolab_Session_Auth $auth + Horde_Kolab_Session_Interface $session, + Horde_Kolab_Session_Auth_Interface $auth ) { return $this->_factory->getSessionValidator($session, $auth); } @@ -125,14 +127,16 @@ implements Horde_Kolab_Session_Factory /** * Validate the given session. * - * @param Horde_Kolab_Session $session The session to validate. - * @param string $user The session will be validated for - * this user ID. + * @param Horde_Kolab_Session_Interface $session The session to validate. + * @param string $user The session will be validated + * for this user ID. * - * @return boolean True if thxe given session is valid. + * @return boolean True if the given session is valid. */ - public function validate(Horde_Kolab_Session $session, $user = null) - { + public function validate( + Horde_Kolab_Session_Interface $session, + $user = null + ) { return $this->_factory->validate($session, $user); } @@ -141,12 +145,12 @@ implements Horde_Kolab_Session_Factory * * @param string $user The session will be setup for the user with this ID. * - * @return Horde_Kolab_Session The concrete Kolab session reference. + * @return Horde_Kolab_Session_Interface The concrete Kolab session reference. */ public function createSession($user = null) { $session = $this->_factory->createSession($user); - $session = new Horde_Kolab_Session_Anonymous( + $session = new Horde_Kolab_Session_Decorator_Anonymous( $session, $this->_anonymous_id, $this->_anonymous_pass @@ -162,7 +166,7 @@ implements Horde_Kolab_Session_Factory * this ID. * @param array $credentials An array of login credentials. * - * @return Horde_Kolab_Session The concrete Kolab session reference. + * @return Horde_Kolab_Session_Interface The concrete Kolab session reference. */ public function getSession($user = null, array $credentials = null) { diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Logged.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Logged.php similarity index 62% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Logged.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Logged.php index c398ebf69..5296712d7 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Logged.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Logged.php @@ -25,13 +25,13 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Factory_Logged -implements Horde_Kolab_Session_Factory +class Horde_Kolab_Session_Factory_Decorator_Logged +implements Horde_Kolab_Session_Factory_Interface { /** * The factory setup resulting from the configuration. * - * @var Horde_Kolab_Session_Factory + * @var Horde_Kolab_Session_Factory_Interface */ private $_factory; @@ -45,11 +45,13 @@ implements Horde_Kolab_Session_Factory /** * Constructor. * - * @param Horde_Kolab_Session_Factory $factory The base factory. - * @param mixed $logger The logger isntance. + * @param Horde_Kolab_Session_Factory_Interface $factory The base factory. + * @param mixed $logger The logger isntance. */ - public function __construct(Horde_Kolab_Session_Factory $factory, $logger) - { + public function __construct( + Horde_Kolab_Session_Factory_Interface $factory, + $logger + ) { $this->_factory = $factory; $this->_logger = $logger; } @@ -57,7 +59,7 @@ implements Horde_Kolab_Session_Factory /** * Return the kolab user db connection. * - * @return Horde_Kolab_Server The server connection. + * @return Horde_Kolab_Server_Interface The server connection. */ public function getServer() { @@ -67,7 +69,7 @@ implements Horde_Kolab_Session_Factory /** * Return the auth handler for sessions. * - * @return Horde_Kolab_Session_Auth The authentication handler. + * @return Horde_Kolab_Session_Auth_Interface The authentication handler. */ public function getSessionAuth() { @@ -87,7 +89,7 @@ implements Horde_Kolab_Session_Factory /** * Return the session storage driver. * - * @return Horde_Kolab_Session_Storage The driver for storing sessions. + * @return Horde_Kolab_Session_Storage_Interface The driver for storing sessions. */ public function getSessionStorage() { @@ -97,31 +99,36 @@ implements Horde_Kolab_Session_Factory /** * Return the session validation driver. * - * @param Horde_Kolab_Session $session The session to validate. - * @param Horde_Kolab_Session_Auth $auth The auth handler. + * @param Horde_Kolab_Session_Interface $session The session to validate. + * @param Horde_Kolab_Session_Auth_Interface $auth The auth handler. * - * @return Horde_Kolab_Session_Valid The driver for validating sessions. + * @return Horde_Kolab_Session_Valid_Interface The driver for validating + * sessions. */ public function getSessionValidator( - Horde_Kolab_Session $session, - Horde_Kolab_Session_Auth $auth + Horde_Kolab_Session_Interface $session, + Horde_Kolab_Session_Auth_Interface $auth ) { $valid = $this->_factory->getSessionValidator($session, $auth); - $valid = new Horde_Kolab_Session_Valid_Logged($valid, $this->_logger); + $valid = new Horde_Kolab_Session_Valid_Decorator_Logged( + $valid, $this->_logger + ); return $valid; } /** * Validate the given session. * - * @param Horde_Kolab_Session $session The session to validate. - * @param string $user The session will be validated for - * this user ID. + * @param Horde_Kolab_Session_Interface $session The session to validate. + * @param string $user The session will be validated + * for this user ID. * - * @return boolean True if thxe given session is valid. + * @return boolean True if the given session is valid. */ - public function validate(Horde_Kolab_Session $session, $user = null) - { + public function validate( + Horde_Kolab_Session_Interface $session, + $user = null + ) { return $this->_factory->validate($session, $user); } @@ -130,12 +137,14 @@ implements Horde_Kolab_Session_Factory * * @param string $user The session will be setup for the user with this ID. * - * @return Horde_Kolab_Session The concrete Kolab session reference. + * @return Horde_Kolab_Session_Interface The concrete Kolab session reference. */ public function createSession($user = null) { $session = $this->_factory->createSession($user); - $session = new Horde_Kolab_Session_Logged($session, $this->_logger); + $session = new Horde_Kolab_Session_Decorator_Logged( + $session, $this->_logger + ); return $session; } @@ -147,7 +156,7 @@ implements Horde_Kolab_Session_Factory * this ID. * @param array $credentials An array of login credentials. * - * @return Horde_Kolab_Session The concrete Kolab session reference. + * @return Horde_Kolab_Session_Interface The concrete Kolab session reference. */ public function getSession($user = null, array $credentials = null) { diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Interface.php similarity index 65% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Factory.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Interface.php index 9fdba64f3..ecb592a17 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Interface.php @@ -25,19 +25,19 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -interface Horde_Kolab_Session_Factory +interface Horde_Kolab_Session_Factory_Interface { /** * Return the kolab user db connection. * - * @return Horde_Kolab_Server The server connection. + * @return Horde_Kolab_Server_Interface The server connection. */ public function getServer(); /** * Return the auth handler for sessions. * - * @return Horde_Kolab_Session_Auth The authentication handler. + * @return Horde_Kolab_Session_Auth_Interface The authentication handler. */ public function getSessionAuth(); @@ -51,21 +51,22 @@ interface Horde_Kolab_Session_Factory /** * Return the session storage driver. * - * @return Horde_Kolab_Session_Storage The driver for storing sessions. + * @return Horde_Kolab_Session_Storage_Interface The driver for storing sessions. */ public function getSessionStorage(); /** * Return the session validation driver. * - * @param Horde_Kolab_Session $session The session to validate. - * @param Horde_Kolab_Session_Auth $auth The auth handler. + * @param Horde_Kolab_Session_Interface $session The session to validate. + * @param Horde_Kolab_Session_Auth_Interface $auth The auth handler. * - * @return Horde_Kolab_Session_Valid The driver for validating sessions. + * @return Horde_Kolab_Session_Valid_Interface The driver for validating + * sessions. */ public function getSessionValidator( - Horde_Kolab_Session $session, - Horde_Kolab_Session_Auth $auth + Horde_Kolab_Session_Interface $session, + Horde_Kolab_Session_Auth_Interface $auth ); /** @@ -73,20 +74,23 @@ interface Horde_Kolab_Session_Factory * * Validate the given session. * - * @param Horde_Kolab_Session $session The session to validate. - * @param string $user The session will be validated for - * this user ID. + * @param Horde_Kolab_Session_Interface $session The session to validate. + * @param string $user The session will be validated + * for this user ID. * * @return boolean True if the given session is valid. */ - public function validate(Horde_Kolab_Session $session, $user = null); + public function validate( + Horde_Kolab_Session_Interface $session, + $user = null + ); /** * Returns a new session handler. * * @param string $user The session will be setup for the user with this ID. * - * @return Horde_Kolab_Session The concrete Kolab session reference. + * @return Horde_Kolab_Session_Interface The concrete Kolab session reference. */ public function createSession($user = null); @@ -98,7 +102,7 @@ interface Horde_Kolab_Session_Factory * this ID. * @param array $credentials An array of login credentials. * - * @return Horde_Kolab_Session The concrete Kolab session reference. + * @return Horde_Kolab_Session_Interface The concrete Kolab session reference. */ public function getSession($user = null, array $credentials = null); } diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Interface.php similarity index 98% rename from framework/Kolab_Session/lib/Horde/Kolab/Session.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Interface.php index f36a04ade..2c422591f 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Interface.php @@ -35,7 +35,7 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -interface Horde_Kolab_Session +interface Horde_Kolab_Session_Interface { /** * Try to connect the session handler. diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Interface.php similarity index 91% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Storage.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Interface.php index 5eab9a754..de9a7ef51 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Interface.php @@ -25,7 +25,7 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -interface Horde_Kolab_Session_Storage +interface Horde_Kolab_Session_Storage_Interface { /** * Load the session information. @@ -42,5 +42,5 @@ interface Horde_Kolab_Session_Storage * * @return NULL */ - public function save(Horde_Kolab_Session $session); + public function save(Horde_Kolab_Session_Interface $session); } diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Mock.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Mock.php index 4d3a4155c..de13c944f 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Mock.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Mock.php @@ -26,7 +26,7 @@ * @link http://pear.horde.org/index.php?package=Kolab_Session */ class Horde_Kolab_Session_Storage_Mock -implements Horde_Kolab_Session_Storage +implements Horde_Kolab_Session_Storage_Interface { /** * The session information. @@ -47,11 +47,11 @@ implements Horde_Kolab_Session_Storage /** * Save the session information. * - * @param Horde_Kolab_Session $session The session information. + * @param Horde_Kolab_Session_Interface $session The session information. * * @return NULL */ - public function save(Horde_Kolab_Session $session) + public function save(Horde_Kolab_Session_Interface $session) { $this->session = $session; } diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Sessionobjects.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Sessionobjects.php index c7163fe80..8d5128d47 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Sessionobjects.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Sessionobjects.php @@ -26,7 +26,7 @@ * @link http://pear.horde.org/index.php?package=Kolab_Session */ class Horde_Kolab_Session_Storage_Sessionobjects -implements Horde_Kolab_Session_Storage +implements Horde_Kolab_Session_Storage_Interface { /** * The handler for session objects. @@ -59,11 +59,11 @@ implements Horde_Kolab_Session_Storage /** * Save the session information. * - * @param Horde_Kolab_Session $session The session information. + * @param Horde_Kolab_Session_Interface $session The session information. * * @return NULL */ - public function save(Horde_Kolab_Session $session) + public function save(Horde_Kolab_Session_Interface $session) { $this->_session_objects->overwrite('kolab_session', $session); } diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Base.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Base.php index 1e6be37b8..118cb2f01 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Base.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Base.php @@ -31,32 +31,33 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Valid_Base implements Horde_Kolab_Session_Valid +class Horde_Kolab_Session_Valid_Base +implements Horde_Kolab_Session_Valid_Interface { /** * The session handler this instance provides with anonymous access. * - * @var Horde_Kolab_Session + * @var Horde_Kolab_Session_Interface */ private $_session; /** * Provides authentication information for this object. * - * @var Horde_Kolab_Session_Auth + * @var Horde_Kolab_Session_Auth_Interface */ private $_auth; /** * Constructor. * - * @param Horde_Kolab_Session $session The session that should be - * validated. - * @param Horde_Kolab_Session_Auth $auth The authentication handler. + * @param Horde_Kolab_Session_Interface $session The session that should be + * validated. + * @param Horde_Kolab_Session_Auth_Interface $auth The authentication handler. */ public function __construct( - Horde_Kolab_Session $session, - Horde_Kolab_Session_Auth $auth + Horde_Kolab_Session_Interface $session, + Horde_Kolab_Session_Auth_Interface $auth ) { $this->_session = $session; $this->_auth = $auth; @@ -89,7 +90,8 @@ class Horde_Kolab_Session_Valid_Base implements Horde_Kolab_Session_Valid /** * Return the session this validator checks. * - * @return Horde_Kolab_Session The session checked by this validator. + * @return Horde_Kolab_Session_Interface The session checked by this + * validator. */ public function getSession() { @@ -99,7 +101,8 @@ class Horde_Kolab_Session_Valid_Base implements Horde_Kolab_Session_Valid /** * Return the auth driver of this validator. * - * @return Horde_Kolab_Session_Auth The auth driver set for this validator. + * @return Horde_Kolab_Session_Auth_Interface The auth driver set for this + * validator. */ public function getAuth() { diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Logged.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Decorator/Logged.php similarity index 80% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Logged.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Decorator/Logged.php index bb0f70380..bae5a8008 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Logged.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Decorator/Logged.php @@ -25,12 +25,13 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Valid_Logged implements Horde_Kolab_Session_Valid +class Horde_Kolab_Session_Valid_Decorator_Logged +implements Horde_Kolab_Session_Valid_Interface { /** * The valid handler. * - * @var Horde_Kolab_Session_Valid + * @var Horde_Kolab_Session_Valid_Interface */ private $_valid; @@ -47,11 +48,13 @@ class Horde_Kolab_Session_Valid_Logged implements Horde_Kolab_Session_Valid * The provided logger class needs to implement the methods info() and * err(). * - * @param Horde_Kolab_Session_Valid $valid The validator. - * @param mixed $logger The logger instance. + * @param Horde_Kolab_Session_Valid_Interface $valid The validator. + * @param mixed $logger The logger instance. */ - public function __construct(Horde_Kolab_Session_Valid $valid, $logger) - { + public function __construct( + Horde_Kolab_Session_Valid_Interface $valid, + $logger + ) { $this->_valid = $valid; $this->_logger = $logger; } @@ -85,7 +88,8 @@ class Horde_Kolab_Session_Valid_Logged implements Horde_Kolab_Session_Valid /** * Return the session this validator checks. * - * @return Horde_Kolab_Session The session checked by this validator. + * @return Horde_Kolab_Session_Interface The session checked by this + * validator. */ public function getSession() { @@ -95,7 +99,8 @@ class Horde_Kolab_Session_Valid_Logged implements Horde_Kolab_Session_Valid /** * Return the auth driver of this validator. * - * @return Horde_Kolab_Session_Auth The auth driver set for this validator. + * @return Horde_Kolab_Session_Auth_Interface The auth driver set for this + * validator. */ public function getAuth() { diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Interface.php similarity index 87% rename from framework/Kolab_Session/lib/Horde/Kolab/Session/Valid.php rename to framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Interface.php index a1c2fe8b5..bb3991493 100644 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid.php +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Interface.php @@ -31,7 +31,7 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -interface Horde_Kolab_Session_Valid +interface Horde_Kolab_Session_Valid_Interface { /** * Does the current session still match the authentication information? @@ -47,14 +47,16 @@ interface Horde_Kolab_Session_Valid /** * Return the session this validator checks. * - * @return Horde_Kolab_Session The session checked by this validator. + * @return Horde_Kolab_Session_Interface The session checked by this + * validator. */ public function getSession(); /** * Return the auth driver of this validator. * - * @return Horde_Kolab_Session_Auth The auth driver set for this validator. + * @return Horde_Kolab_Session_Auth_Interface The auth driver set for this + * validator. */ public function getAuth(); } \ No newline at end of file diff --git a/framework/Kolab_Session/package.xml b/framework/Kolab_Session/package.xml index 5918bfa54..000b6933d 100644 --- a/framework/Kolab_Session/package.xml +++ b/framework/Kolab_Session/package.xml @@ -45,41 +45,47 @@ http://pear.php.net/dtd/package-2.0.xsd"> - - - + + + + + + - - + + + + - + - + - + - - - + + + + @@ -92,30 +98,36 @@ http://pear.php.net/dtd/package-2.0.xsd"> - - + + + + + + + + + - - - - + + + @@ -170,50 +182,50 @@ http://pear.php.net/dtd/package-2.0.xsd"> - - - + - - + + + + + - - + + - + - - - + + - - + + + + + - - - - + diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/AnonymousTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php similarity index 71% rename from framework/Kolab_Session/test/Horde/Kolab/Session/Class/AnonymousTest.php rename to framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php index 05b0f2b24..d98e4c659 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/AnonymousTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php @@ -14,7 +14,7 @@ /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/../Autoload.php'; +require_once dirname(__FILE__) . '/../../Autoload.php'; /** * Test the anonymous decorator. @@ -30,11 +30,12 @@ require_once dirname(__FILE__) . '/../Autoload.php'; * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_SessionTestCase +class Horde_Kolab_Session_Class_Decorator_AnonymousTest +extends Horde_Kolab_Session_SessionTestCase { public function testMethodConnectHasPostconditionThatTheConnectionHasBeenEstablishedAsAnonymousUserIfRequired() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getId') ->will($this->returnValue(null)); @@ -44,7 +45,7 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio $session->expects($this->once()) ->method('connect') ->with(array('password' => 'pass')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->connect(); @@ -52,11 +53,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodGetidReturnsNullIfConnectedUserIsAnonymousUser() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getId') ->will($this->returnValue('anonymous')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $this->assertNull($anonymous->getId()); @@ -64,11 +65,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodConnectGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('connect') ->with(array('password' => 'pass')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->connect(array('password' => 'pass')); @@ -76,11 +77,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodGetidGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getId') ->will($this->returnValue('1')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->getId(); @@ -88,11 +89,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodSetidGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('setId') ->with('1'); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->setId('1'); @@ -100,11 +101,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodGetmailGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('1')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->getMail(); @@ -112,11 +113,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodGetuidGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getUid') ->will($this->returnValue('1')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->getUid(); @@ -124,11 +125,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodGetnameGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getName') ->will($this->returnValue('1')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->getName(); @@ -136,11 +137,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodGetimapserverGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getImapServer') ->will($this->returnValue('1')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->getImapServer(); @@ -148,11 +149,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodGetfreebusyserverGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getFreebusyServer') ->will($this->returnValue('1')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->getFreebusyServer(); @@ -160,11 +161,11 @@ class Horde_Kolab_Session_Class_AnonymousTest extends Horde_Kolab_Session_Sessio public function testMethodGetstorageGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getStorage') ->will($this->returnValue('1')); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->getStorage(); diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php similarity index 65% rename from framework/Kolab_Session/test/Horde/Kolab/Session/Class/LoggedTest.php rename to framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php index f8be5455e..80bf6c5e2 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/LoggedTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php @@ -14,7 +14,7 @@ /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/../Autoload.php'; +require_once dirname(__FILE__) . '/../../Autoload.php'; /** * Test the log decorator. @@ -30,7 +30,8 @@ require_once dirname(__FILE__) . '/../Autoload.php'; * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Class_LoggedTest extends Horde_Kolab_Session_SessionTestCase +class Horde_Kolab_Session_Class_Decorator_LoggedTest +extends Horde_Kolab_Session_SessionTestCase { public function setUp() { @@ -41,7 +42,7 @@ class Horde_Kolab_Session_Class_LoggedTest extends Horde_Kolab_Session_SessionTe public function testMethodConnectHasPostconditionThatASuccessfulConnectionGetsLogged() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('connect') ->with(array('password' => 'pass')); @@ -52,15 +53,19 @@ class Horde_Kolab_Session_Class_LoggedTest extends Horde_Kolab_Session_SessionTe ->method('__call') ->with( 'info', - array('Connected Kolab session for "somebody@example.org".') + array( + 'Connected Kolab session for "somebody@example.org".' + ) ); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged( + $session, $this->logger + ); $logged->connect(array('password' => 'pass')); } public function testMethodConnectHasPostconditionThatAnUnsuccessfulConnectionGetsLogged() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('connect') ->will($this->throwException(new Horde_Kolab_Session_Exception('Error.'))); @@ -71,9 +76,13 @@ class Horde_Kolab_Session_Class_LoggedTest extends Horde_Kolab_Session_SessionTe ->method('__call') ->with( 'err', - array('Failed to connect Kolab session for "somebody@example.org". Error was: Error.') + array( + 'Failed to connect Kolab session for "somebody@example.org". Error was: Error.' + ) ); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged( + $session, $this->logger + ); try { $logged->connect(array('password' => 'pass')); $this->fail('No Exception!'); @@ -83,91 +92,91 @@ class Horde_Kolab_Session_Class_LoggedTest extends Horde_Kolab_Session_SessionTe public function testMethodConnectGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('connect') ->with(array('password' => 'pass')); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger); $logged->connect(array('password' => 'pass')); } public function testMethodGetidGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getId') ->will($this->returnValue('1')); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger); $logged->getId(); } public function testMethodSetidGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('setId') ->with('1'); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger); $logged->setId('1'); } public function testMethodGetmailGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('1')); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger); $logged->getMail(); } public function testMethodGetuidGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getUid') ->will($this->returnValue('1')); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger); $logged->getUid(); } public function testMethodGetnameGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getName') ->will($this->returnValue('1')); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger); $logged->getName(); } public function testMethodGetimapserverGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getImapServer') ->will($this->returnValue('1')); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger); $logged->getImapServer(); } public function testMethodGetfreebusyserverGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getFreebusyServer') ->will($this->returnValue('1')); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger); $logged->getFreebusyServer(); } public function testMethodGetstorageGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getStorage') ->will($this->returnValue('1')); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger); $logged->getStorage(); } diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/StoredTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php similarity index 63% rename from framework/Kolab_Session/test/Horde/Kolab/Session/Class/StoredTest.php rename to framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php index 767da7be5..f18146391 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/StoredTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php @@ -14,7 +14,7 @@ /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/../Autoload.php'; +require_once dirname(__FILE__) . '/../../Autoload.php'; /** * Test the storing decorator. @@ -30,7 +30,8 @@ require_once dirname(__FILE__) . '/../Autoload.php'; * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Class_StoredTest extends Horde_Kolab_Session_SessionTestCase +class Horde_Kolab_Session_Class_Decorator_StoredTest +extends Horde_Kolab_Session_SessionTestCase { public function setUp() { @@ -43,99 +44,99 @@ class Horde_Kolab_Session_Class_StoredTest extends Horde_Kolab_Session_SessionTe { $this->storage->expects($this->once()) ->method('save') - ->with($this->isInstanceOf('Horde_Kolab_Session')); - $session = $this->getMock('Horde_Kolab_Session'); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + ->with($this->isInstanceOf('Horde_Kolab_Session_Interface')); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored = null; } public function testMethodConnectGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('connect') ->with(array('password' => 'pass')); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored->connect(array('password' => 'pass')); } public function testMethodGetidGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getId') ->will($this->returnValue('1')); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored->getId(); } public function testMethodSetidGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('setId') ->with('1'); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored->setId('1'); } public function testMethodGetmailGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('1')); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored->getMail(); } public function testMethodGetuidGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getUid') ->will($this->returnValue('1')); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored->getUid(); } public function testMethodGetnameGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getName') ->will($this->returnValue('1')); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored->getName(); } public function testMethodGetimapserverGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getImapServer') ->will($this->returnValue('1')); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored->getImapServer(); } public function testMethodGetfreebusyserverGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getFreebusyServer') ->will($this->returnValue('1')); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored->getFreebusyServer(); } public function testMethodGetstorageGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getStorage') ->will($this->returnValue('1')); - $stored = new Horde_Kolab_Session_Stored($session, $this->storage); + $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage); $stored->getStorage(); } diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/BaseTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/BaseTest.php index 0ff43c543..2284c165e 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/BaseTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/BaseTest.php @@ -43,12 +43,12 @@ class Horde_Kolab_Session_Class_Factory_BaseTest extends Horde_Kolab_Session_Ses public function testMethodGetvalidatorHasResultHordekolabsesessionvalid() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $factory = new Horde_Kolab_Session_Factory_Constructor( $this->server, $this->session_auth, array(), $this->session_storage ); $this->assertType( - 'Horde_Kolab_Session_Valid', + 'Horde_Kolab_Session_Valid_Interface', $factory->getSessionValidator($session, $this->session_auth) ); } @@ -58,7 +58,7 @@ class Horde_Kolab_Session_Class_Factory_BaseTest extends Horde_Kolab_Session_Ses $this->session_auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('mail@example.org')); - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('mail@example.org')); @@ -73,12 +73,12 @@ class Horde_Kolab_Session_Class_Factory_BaseTest extends Horde_Kolab_Session_Ses $factory = new Horde_Kolab_Session_Factory_Constructor( $this->server, $this->session_auth, array(), $this->session_storage ); - $this->assertType('Horde_Kolab_Session_Stored', $factory->createSession()); + $this->assertType('Horde_Kolab_Session_Decorator_Stored', $factory->createSession()); } public function testMethodGetsessionHasResultHordekolabsessionTheOldSessionIfAnOldSessionWasStoredAndValid() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('mail@example.org')); @@ -96,7 +96,7 @@ class Horde_Kolab_Session_Class_Factory_BaseTest extends Horde_Kolab_Session_Ses public function testMethodGetsessionHasResultHordekolabsessionANewSessionIfAnOldSessionWasStoredAndInvalid() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('mail@example.org')); @@ -138,6 +138,6 @@ class Horde_Kolab_Session_Class_Factory_BaseTest extends Horde_Kolab_Session_Ses $factory = new Horde_Kolab_Session_Factory_Constructor( $this->server, $this->session_auth, array(), $this->session_storage ); - $this->assertType('Horde_Kolab_Session', $factory->getSession()); + $this->assertType('Horde_Kolab_Session_Interface', $factory->getSession()); } } \ No newline at end of file diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConfigurationTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConfigurationTest.php index 5946485de..f47b6195d 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConfigurationTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConfigurationTest.php @@ -67,7 +67,7 @@ class Horde_Kolab_Session_Class_Factory_ConfigurationTest extends Horde_Kolab_Se ) ); $this->assertType( - 'Horde_Kolab_Session_Anonymous', + 'Horde_Kolab_Session_Decorator_Anonymous', $factory->createSession() ); } @@ -83,15 +83,15 @@ class Horde_Kolab_Session_Class_Factory_ConfigurationTest extends Horde_Kolab_Se ) ); $this->assertType( - 'Horde_Kolab_Session_Logged', + 'Horde_Kolab_Session_Decorator_Logged', $factory->createSession() ); } public function testMethodGetsessionvalidatorHasResultHordekolabsessionvalidloggedIfConfiguredThatWay() { - $session = $this->getMock('Horde_Kolab_Session'); - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $factory = new Horde_Kolab_Session_Factory_Configuration( array( 'logger' => $this->logger, @@ -101,7 +101,7 @@ class Horde_Kolab_Session_Class_Factory_ConfigurationTest extends Horde_Kolab_Se ) ); $this->assertType( - 'Horde_Kolab_Session_Valid_Logged', + 'Horde_Kolab_Session_Valid_Decorator_Logged', $factory->getSessionValidator($session, $auth) ); } @@ -131,7 +131,7 @@ class Horde_Kolab_Session_Class_Factory_ConfigurationTest extends Horde_Kolab_Se ) ); $this->assertType( - 'Horde_Kolab_Session_Auth', + 'Horde_Kolab_Session_Auth_Interface', $factory->getSessionAuth() ); } @@ -158,15 +158,15 @@ class Horde_Kolab_Session_Class_Factory_ConfigurationTest extends Horde_Kolab_Se ) ); $this->assertType( - 'Horde_Kolab_Session_Storage', + 'Horde_Kolab_Session_Storage_Interface', $factory->getSessionStorage() ); } public function testMethodGetsessionvalidatorHasResultSessionvalid() { - $session = $this->getMock('Horde_Kolab_Session'); - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $factory = new Horde_Kolab_Session_Factory_Configuration( array( 'server' => array( @@ -175,14 +175,14 @@ class Horde_Kolab_Session_Class_Factory_ConfigurationTest extends Horde_Kolab_Se ) ); $this->assertType( - 'Horde_Kolab_Session_Valid', + 'Horde_Kolab_Session_Valid_Interface', $factory->getSessionValidator($session, $auth) ); } public function testMethodValidateHasResultBooleanTrueIfTheSessionIsStillValid() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $factory = new Horde_Kolab_Session_Factory_Configuration( array( 'server' => array( @@ -202,7 +202,7 @@ class Horde_Kolab_Session_Class_Factory_ConfigurationTest extends Horde_Kolab_Se ) ) ); - $this->assertType('Horde_Kolab_Session', $factory->createSession()); + $this->assertType('Horde_Kolab_Session_Interface', $factory->createSession()); } public function testMethodGetsessionHasResultSession() @@ -226,6 +226,6 @@ class Horde_Kolab_Session_Class_Factory_ConfigurationTest extends Horde_Kolab_Se ) ) ); - $this->assertType('Horde_Kolab_Session', $factory->getSession()); + $this->assertType('Horde_Kolab_Session_Interface', $factory->getSession()); } } \ No newline at end of file diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConstructorTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConstructorTest.php index d80a0354c..6a23d9ddc 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConstructorTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConstructorTest.php @@ -51,7 +51,7 @@ class Horde_Kolab_Session_Class_Factory_ConstructorTest extends Horde_Kolab_Sess $factory = new Horde_Kolab_Session_Factory_Constructor( $this->server, $this->session_auth, array(), $this->session_storage ); - $this->assertType('Horde_Kolab_Session_Auth', $factory->getSessionAuth()); + $this->assertType('Horde_Kolab_Session_Auth_Interface', $factory->getSessionAuth()); } public function testMethodGetsessionconfigurationHasResultArray() @@ -67,6 +67,6 @@ class Horde_Kolab_Session_Class_Factory_ConstructorTest extends Horde_Kolab_Sess $factory = new Horde_Kolab_Session_Factory_Constructor( $this->server, $this->session_auth, array(), $this->session_storage ); - $this->assertType('Horde_Kolab_Session_Storage', $factory->getSessionStorage()); + $this->assertType('Horde_Kolab_Session_Storage_Interface', $factory->getSessionStorage()); } } \ No newline at end of file diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/AnonymousTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/AnonymousTest.php similarity index 59% rename from framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/AnonymousTest.php rename to framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/AnonymousTest.php index 6209ea7eb..50abdeb74 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/AnonymousTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/AnonymousTest.php @@ -14,7 +14,7 @@ /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/../../Autoload.php'; +require_once dirname(__FILE__) . '/../../../Autoload.php'; /** * Test the anonymous decorator factory. @@ -30,20 +30,21 @@ require_once dirname(__FILE__) . '/../../Autoload.php'; * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Class_Factory_AnonymousTest extends Horde_Kolab_Session_SessionTestCase +class Horde_Kolab_Session_Class_Factory_Decorator_AnonymousTest +extends Horde_Kolab_Session_SessionTestCase { public function testMethodCreatesessionHasResultHordekolabsessionanonymous() { - $session = $this->getMock('Horde_Kolab_Session'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('createSession') ->will($this->returnValue($session)); - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, 'anonymous', '' ); $this->assertType( - 'Horde_Kolab_Session_Anonymous', + 'Horde_Kolab_Session_Decorator_Anonymous', $factory->createSession() ); } @@ -51,11 +52,11 @@ class Horde_Kolab_Session_Class_Factory_AnonymousTest extends Horde_Kolab_Sessio public function testMethodGetserverGetsDelegated() { $server = $this->getMock('Horde_Kolab_Server'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getServer') ->will($this->returnValue($server)); - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, 'anonymous', '' ); $this->assertType('Horde_Kolab_Server', $factory->getServer()); @@ -63,27 +64,27 @@ class Horde_Kolab_Session_Class_Factory_AnonymousTest extends Horde_Kolab_Sessio public function testMethodGetsessionauthGetsDelegated() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSessionAuth') ->will($this->returnValue($auth)); - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, 'anonymous', '' ); $this->assertType( - 'Horde_Kolab_Session_Auth', + 'Horde_Kolab_Session_Auth_Interface', $factory->getSessionAuth() ); } public function testMethodGetsessionconfigurationGetsDelegated() { - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSessionConfiguration') ->will($this->returnValue(array())); - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, 'anonymous', '' ); $this->assertType('array', $factory->getSessionConfiguration()); @@ -91,46 +92,46 @@ class Horde_Kolab_Session_Class_Factory_AnonymousTest extends Horde_Kolab_Sessio public function testMethodGetsessionstorageGetsDelegated() { - $storage = $this->getMock('Horde_Kolab_Session_Storage'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $storage = $this->getMock('Horde_Kolab_Session_Storage_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSessionStorage') ->will($this->returnValue($storage)); - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, 'anonymous', '' ); $this->assertType( - 'Horde_Kolab_Session_Storage', + 'Horde_Kolab_Session_Storage_Interface', $factory->getSessionStorage() ); } public function testMethodGetsessionvalidatorGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); - $auth = $this->getMock('Horde_Kolab_Session_Auth'); - $validator = $this->getMock('Horde_Kolab_Session_Valid'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); + $validator = $this->getMock('Horde_Kolab_Session_Valid_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSessionValidator') ->will($this->returnValue($validator)); - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, 'anonymous', '' ); $this->assertType( - 'Horde_Kolab_Session_Valid', + 'Horde_Kolab_Session_Valid_Interface', $factory->getSessionValidator($session, $auth) ); } public function testMethodValidateGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('validate') ->will($this->returnValue(true)); - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, 'anonymous', '' ); $this->assertTrue($factory->validate($session, 'test')); @@ -138,27 +139,27 @@ class Horde_Kolab_Session_Class_Factory_AnonymousTest extends Horde_Kolab_Sessio public function testMethodCreatesessionGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('createSession') ->will($this->returnValue($session)); - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, 'anonymous', '' ); - $this->assertType('Horde_Kolab_Session', $factory->createSession()); + $this->assertType('Horde_Kolab_Session_Interface', $factory->createSession()); } public function testMethodGetsessionGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSession') ->will($this->returnValue($session)); - $factory = new Horde_Kolab_Session_Factory_Anonymous( + $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous( $factory, 'anonymous', '' ); - $this->assertType('Horde_Kolab_Session', $factory->getSession()); + $this->assertType('Horde_Kolab_Session_Interface', $factory->getSession()); } } \ No newline at end of file diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/LoggedTest.php similarity index 62% rename from framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/LoggedTest.php rename to framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/LoggedTest.php index 367b134b0..32b2cb173 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/LoggedTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/LoggedTest.php @@ -14,7 +14,7 @@ /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/../../Autoload.php'; +require_once dirname(__FILE__) . '/../../../Autoload.php'; /** * Test the log decorator factory. @@ -30,7 +30,8 @@ require_once dirname(__FILE__) . '/../../Autoload.php'; * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Class_Factory_LoggedTest extends Horde_Kolab_Session_SessionTestCase +class Horde_Kolab_Session_Class_Factory_Decorator_LoggedTest +extends Horde_Kolab_Session_SessionTestCase { public function setUp() { @@ -40,34 +41,34 @@ class Horde_Kolab_Session_Class_Factory_LoggedTest extends Horde_Kolab_Session_S public function testMethodCreatesessionHasResultHordekolabsessionlogged() { - $session = $this->getMock('Horde_Kolab_Session'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('createSession') ->will($this->returnValue($session)); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); $this->assertType( - 'Horde_Kolab_Session_Logged', + 'Horde_Kolab_Session_Decorator_Logged', $factory->createSession() ); } public function testMethodGetsessionvalidatorHasResultHordekolabsessionvalidlogged() { - $session = $this->getMock('Horde_Kolab_Session'); - $auth = $this->getMock('Horde_Kolab_Session_Auth'); - $validator = $this->getMock('Horde_Kolab_Session_Valid'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); + $validator = $this->getMock('Horde_Kolab_Session_Valid_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSessionValidator') ->will($this->returnValue($validator)); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); $this->assertType( - 'Horde_Kolab_Session_Valid_Logged', + 'Horde_Kolab_Session_Valid_Decorator_Logged', $factory->getSessionValidator($session, $auth) ); } @@ -75,11 +76,11 @@ class Horde_Kolab_Session_Class_Factory_LoggedTest extends Horde_Kolab_Session_S public function testMethodGetserverGetsDelegated() { $server = $this->getMock('Horde_Kolab_Server'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getServer') ->will($this->returnValue($server)); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); $this->assertType('Horde_Kolab_Server', $factory->getServer()); @@ -88,11 +89,11 @@ class Horde_Kolab_Session_Class_Factory_LoggedTest extends Horde_Kolab_Session_S public function testMethodGetsessionauthGetsDelegated() { $auth = $this->getMock('Horde_Kolab_Session_Auth'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSessionAuth') ->will($this->returnValue($auth)); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); $this->assertType( @@ -103,11 +104,11 @@ class Horde_Kolab_Session_Class_Factory_LoggedTest extends Horde_Kolab_Session_S public function testMethodGetsessionconfigurationGetsDelegated() { - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSessionConfiguration') ->will($this->returnValue(array())); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); $this->assertType('array', $factory->getSessionConfiguration()); @@ -116,11 +117,11 @@ class Horde_Kolab_Session_Class_Factory_LoggedTest extends Horde_Kolab_Session_S public function testMethodGetsessionstorageGetsDelegated() { $storage = $this->getMock('Horde_Kolab_Session_Storage'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSessionStorage') ->will($this->returnValue($storage)); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); $this->assertType( @@ -131,30 +132,30 @@ class Horde_Kolab_Session_Class_Factory_LoggedTest extends Horde_Kolab_Session_S public function testMethodGetsessionvalidatorGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); - $auth = $this->getMock('Horde_Kolab_Session_Auth'); - $validator = $this->getMock('Horde_Kolab_Session_Valid'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); + $validator = $this->getMock('Horde_Kolab_Session_Valid_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSessionValidator') ->will($this->returnValue($validator)); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); $this->assertType( - 'Horde_Kolab_Session_Valid', + 'Horde_Kolab_Session_Valid_Interface', $factory->getSessionValidator($session, $auth) ); } public function testMethodValidateGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('validate') ->will($this->returnValue(true)); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); $this->assertTrue($factory->validate($session, 'test')); @@ -162,27 +163,27 @@ class Horde_Kolab_Session_Class_Factory_LoggedTest extends Horde_Kolab_Session_S public function testMethodCreatesessionGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('createSession') ->will($this->returnValue($session)); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); - $this->assertType('Horde_Kolab_Session', $factory->createSession()); + $this->assertType('Horde_Kolab_Session_Interface', $factory->createSession()); } public function testMethodGetsessionGetsDelegated() { - $session = $this->getMock('Horde_Kolab_Session'); - $factory = $this->getMock('Horde_Kolab_Session_Factory'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); + $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface'); $factory->expects($this->once()) ->method('getSession') ->will($this->returnValue($session)); - $factory = new Horde_Kolab_Session_Factory_Logged( + $factory = new Horde_Kolab_Session_Factory_Decorator_Logged( $factory, $this->logger ); - $this->assertType('Horde_Kolab_Session', $factory->getSession()); + $this->assertType('Horde_Kolab_Session_Interface', $factory->getSession()); } } \ No newline at end of file diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/DefaultTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/DefaultTest.php index c22d8926d..14587b3b2 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/DefaultTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/DefaultTest.php @@ -54,7 +54,7 @@ class Horde_Kolab_Session_Class_Factory_DefaultTest extends Horde_Kolab_Session_ array('server' => array()), $this->getMock('Horde_Kolab_Server_Factory_Interface') ); - $this->assertType('Horde_Kolab_Session_Auth', $factory->getSessionAuth()); + $this->assertType('Horde_Kolab_Session_Auth_Interface', $factory->getSessionAuth()); } public function testMethodGetsessionconfigurationHasResultArray() @@ -72,6 +72,6 @@ class Horde_Kolab_Session_Class_Factory_DefaultTest extends Horde_Kolab_Session_ array('server' => array()), $this->getMock('Horde_Kolab_Server_Factory_Interface') ); - $this->assertType('Horde_Kolab_Session_Storage', $factory->getSessionStorage()); + $this->assertType('Horde_Kolab_Session_Storage_Interface', $factory->getSessionStorage()); } } \ No newline at end of file diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/InjectorTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/InjectorTest.php index 24dab3fd6..d455efc9d 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/InjectorTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/InjectorTest.php @@ -51,7 +51,7 @@ class Horde_Kolab_Session_Class_Factory_InjectorTest extends Horde_Kolab_Session $factory = new Horde_Kolab_Session_Factory_Injector( array('server' => array()), $this->injector ); - $this->assertType('Horde_Kolab_Session_Auth', $factory->getSessionAuth()); + $this->assertType('Horde_Kolab_Session_Auth_Interface', $factory->getSessionAuth()); } public function testMethodGetsessionconfigurationHasResultArray() @@ -67,6 +67,6 @@ class Horde_Kolab_Session_Class_Factory_InjectorTest extends Horde_Kolab_Session $factory = new Horde_Kolab_Session_Factory_Injector( array('server' => array()), $this->injector ); - $this->assertType('Horde_Kolab_Session_Storage', $factory->getSessionStorage()); + $this->assertType('Horde_Kolab_Session_Storage_Interface', $factory->getSessionStorage()); } } \ No newline at end of file diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/MockTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/MockTest.php index b18725984..d08a8641f 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/MockTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/MockTest.php @@ -40,7 +40,7 @@ class Horde_Kolab_Session_Class_Storage_MockTest extends Horde_Kolab_Session_Ses public function testMethodSaveHasPostconditionThatTheSessionDataWasSaved() { - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $storage = new Horde_Kolab_Session_Storage_Mock('test'); $storage->save($session); $this->assertSame($session, $storage->session); diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php index ec620a6a8..06be6bea7 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php @@ -47,8 +47,8 @@ class Horde_Kolab_Session_Class_Storage_SessionobjectsTest extends Horde_Kolab_S $session_objects = $this->getMock('Horde_SessionObjects', array(), array(), '', false, false); $session_objects->expects($this->once()) ->method('overwrite') - ->with('kolab_session', $this->isInstanceOf('Horde_Kolab_Session')); - $session = $this->getMock('Horde_Kolab_Session'); + ->with('kolab_session', $this->isInstanceOf('Horde_Kolab_Session_Interface')); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $storage = new Horde_Kolab_Session_Storage_Sessionobjects($session_objects); $storage->save($session); } diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/BaseTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/BaseTest.php index 7f9b700df..42a976df2 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/BaseTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/BaseTest.php @@ -34,11 +34,11 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi { public function testMethodIsvalidHasResultBooleanTrueIfTheSessionIsNotConnectedAndTheCurrentUserIsAnonymous() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('')); - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('')); @@ -48,11 +48,11 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi public function testMethodIsvalidHasResultBooleanFalseIfTheSessionIsNotConnected() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('mail@example.org')); - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('')); @@ -62,11 +62,11 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi public function testMethodIsvalidHasResultBooleanFalseIfTheMailOfTheCurrentUserDoesNotMatchTheCurrentUserOfTheSession() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('somebody@example.org')); - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('mail@example.org')); @@ -76,11 +76,11 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi public function testMethodIsvalidHasResultBooleanTrueIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndNoNewUserWasSet() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('mail@example.org')); - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('mail@example.org')); @@ -90,11 +90,11 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi public function testMethodIsvalidHasResultBooleanFalseIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndTheNewUserMatchesNeitherTheCurrentUserMailAndUid() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('mail@example.org')); - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('mail@example.org')); @@ -104,11 +104,11 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi public function testMethodIsvalidHasResultBooleanTrueIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndTheNewUserMatchesEitherTheCurrentUserMailAndUid() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('mail@example.org')); - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->once()) ->method('getMail') ->will($this->returnValue('mail@example.org')); diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/Decorator/LoggedTest.php similarity index 69% rename from framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/LoggedTest.php rename to framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/Decorator/LoggedTest.php index bd51d0432..04a59f41b 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/LoggedTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/Decorator/LoggedTest.php @@ -14,7 +14,7 @@ /** * Prepare the test setup. */ -require_once dirname(__FILE__) . '/../../Autoload.php'; +require_once dirname(__FILE__) . '/../../../Autoload.php'; /** * Test the log decorator for validators. @@ -30,7 +30,8 @@ require_once dirname(__FILE__) . '/../../Autoload.php'; * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Class_Valid_LoggedTest extends Horde_Kolab_Session_SessionTestCase +class Horde_Kolab_Session_Class_Valid_Decorator_LoggedTest +extends Horde_Kolab_Session_SessionTestCase { public function setUp() { @@ -41,11 +42,11 @@ class Horde_Kolab_Session_Class_Valid_LoggedTest extends Horde_Kolab_Session_Ses public function testMethodIsvalidHasPostconditionThatAnInvalidSessionGetsLogged() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->exactly(2)) ->method('getCurrentUser') ->will($this->returnValue('auth@example.org')); - $session = $this->getMock('Horde_Kolab_Session'); + $session = $this->getMock('Horde_Kolab_Session_Interface'); $session->expects($this->exactly(2)) ->method('getMail') ->will($this->returnValue('somebody@example.org')); @@ -55,37 +56,43 @@ class Horde_Kolab_Session_Class_Valid_LoggedTest extends Horde_Kolab_Session_Ses 'info', array('Invalid Kolab session for current user "auth@example.org", requested user "nobody@example.org" and stored user "somebody@example.org".') ); - $logged = new Horde_Kolab_Session_Logged($session, $this->logger); + $logged = new Horde_Kolab_Session_Decorator_Logged( + $session, $this->logger + ); $valid = new Horde_Kolab_Session_Valid_Base($session, $auth); - $logged = new Horde_Kolab_Session_Valid_Logged($valid, $this->logger); + $logged = new Horde_Kolab_Session_Valid_Decorator_Logged( + $valid, $this->logger + ); $this->assertFalse($logged->isValid('nobody@example.org')); } public function testMethodIsvalidGetsDelegated() { - $valid = $this->getMock('Horde_Kolab_Session_Valid'); + $valid = $this->getMock('Horde_Kolab_Session_Valid_Interface'); $valid->expects($this->once()) ->method('isValid') ->will($this->returnValue(true)); - $logged = new Horde_Kolab_Session_Valid_Logged($valid, $this->logger); + $logged = new Horde_Kolab_Session_Valid_Decorator_Logged( + $valid, $this->logger + ); $this->assertTrue($logged->isValid()); } public function testMethodGetsessionGetsDelegated() { - $valid = $this->getMock('Horde_Kolab_Session_Valid'); + $valid = $this->getMock('Horde_Kolab_Session_Valid_Interface'); $valid->expects($this->once()) ->method('getSession'); - $logged = new Horde_Kolab_Session_Valid_Logged($valid, $this->logger); + $logged = new Horde_Kolab_Session_Valid_Decorator_Logged($valid, $this->logger); $logged->getSession(); } public function testMethodGetauthGetsDelegated() { - $valid = $this->getMock('Horde_Kolab_Session_Valid'); + $valid = $this->getMock('Horde_Kolab_Session_Valid_Interface'); $valid->expects($this->once()) ->method('getAuth'); - $logged = new Horde_Kolab_Session_Valid_Logged($valid, $this->logger); + $logged = new Horde_Kolab_Session_Valid_Decorator_Logged($valid, $this->logger); $logged->getAuth(); } } \ No newline at end of file diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/AnonymousTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/AnonymousTest.php index 6791dc0dc..a09c46662 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/AnonymousTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/AnonymousTest.php @@ -52,7 +52,7 @@ class Horde_Kolab_Session_Integration_AnonymousTest extends Horde_Kolab_Session_ $session = new Horde_Kolab_Session_Base( '', $composite, array() ); - $anonymous = new Horde_Kolab_Session_Anonymous( + $anonymous = new Horde_Kolab_Session_Decorator_Anonymous( $session, 'anonymous', 'pass' ); $anonymous->connect(); diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SessionTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SessionTest.php index 6166e8c08..3d80fd353 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SessionTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SessionTest.php @@ -30,7 +30,8 @@ require_once dirname(__FILE__) . '/../Autoload.php'; * @license http://www.fsf.org/copyleft/lgpl.html LGPL * @link http://pear.horde.org/index.php?package=Kolab_Session */ -class Horde_Kolab_Session_Integration_SessionTest extends Horde_Kolab_Session_SessionTestCase +class Horde_Kolab_Session_Integration_SessionTest +extends Horde_Kolab_Session_SessionTestCase { /** * Setup function. @@ -93,8 +94,10 @@ class Horde_Kolab_Session_Integration_SessionTest extends Horde_Kolab_Session_Se $this->assertNoError($result); $this->assertEquals(1, count($GLOBALS['KOLAB_SERVER_TEST_DATA'])); - $session = Horde_Kolab_Session::singleton('test', - array('password' => 'test')); + $session = Horde_Kolab_Session::singleton( + 'test', + array('password' => 'test') + ); $this->assertNoError($session->auth); $this->assertEquals('test@example.org', $session->user_mail); @@ -116,7 +119,9 @@ class Horde_Kolab_Session_Integration_SessionTest extends Horde_Kolab_Session_Se $this->assertEquals(143, $params['port']); $this->assertEquals('test@example.org', $session->user_mail); - $this->assertEquals('https://fb.example.org/freebusy', $session->freebusy_server); + $this->assertEquals( + 'https://fb.example.org/freebusy', $session->freebusy_server + ); } /** @@ -157,19 +162,25 @@ class Horde_Kolab_Session_Integration_SessionTest extends Horde_Kolab_Session_Se $this->assertNoError($result); } - $session = Horde_Kolab_Session::singleton('wrobel', - array('password' => 'none'), - true); + $session = Horde_Kolab_Session::singleton( + 'wrobel', + array('password' => 'none'), + true + ); $this->assertNoError($session->auth); $this->assertEquals('wrobel@example.org', $session->user_mail); try { - $session = Horde_Kolab_Session::singleton('test', - array('password' => 'test'), - true); + $session = Horde_Kolab_Session::singleton( + 'test', + array('password' => 'test'), + true + ); } catch (Horde_Kolab_Session_Exception $e) { - $this->assertError($e, 'You are no member of a group that may login on this server.'); + $this->assertError( + $e, 'You are no member of a group that may login on this server.' + ); } // FIXME: Ensure that the session gets overwritten //$this->assertTrue(empty($session->user_mail)); @@ -198,19 +209,25 @@ class Horde_Kolab_Session_Integration_SessionTest extends Horde_Kolab_Session_Se $this->assertNoError($result); } - $session = Horde_Kolab_Session::singleton('test', - array('password' => 'test'), - true); + $session = Horde_Kolab_Session::singleton( + 'test', + array('password' => 'test'), + true + ); $this->assertNoError($session->auth); $this->assertEquals('test@example.org', $session->user_mail); try { - $session = Horde_Kolab_Session::singleton('wrobel', - array('password' => 'none'), - true); + $session = Horde_Kolab_Session::singleton( + 'wrobel', + array('password' => 'none'), + true + ); } catch (Horde_Kolab_Session_Exception $e) { - $this->assertError($e, 'You are member of a group that may not login on this server.'); + $this->assertError( + $e, 'You are member of a group that may not login on this server.' + ); } // FIXME: Ensure that the session gets overwritten //$this->assertTrue(empty($session->user_mail)); diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SingletonTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SingletonTest.php index ecd608da5..af81445e4 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SingletonTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SingletonTest.php @@ -55,7 +55,7 @@ class Horde_Kolab_Session_Integration_SingletonTest extends Horde_Kolab_Session_ public function testMethodSingletonHasResultHordekolabsession() { $this->assertType( - 'Horde_Kolab_Session', + 'Horde_Kolab_Session_Interface', Horde_Kolab_Session_Singleton::singleton( 'user', array('password' => 'pass') ) diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/ValidTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/ValidTest.php index 2a0785afb..a4a62411f 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/ValidTest.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/ValidTest.php @@ -41,7 +41,7 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess public function testMethodIsvalidHasResultBooleanTrueIfTheSessionIsNotConnectedAndTheCurrentUserIsAnonymous() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('')); @@ -55,7 +55,7 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess public function testMethodIsvalidHasResultBooleanFalseIfTheSessionIsNotConnected() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('mail@example.org')); @@ -69,7 +69,7 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess public function testMethodIsvalidHasResultBooleanFalseIfTheMailOfTheCurrentUserDoesNotMatchTheCurrentUserOfTheSession() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('somebody@example.org')); @@ -93,7 +93,7 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess public function testMethodIsvalidHasResultBooleanTrueIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndNoNewUserWasSet() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('mail@example.org')); @@ -117,7 +117,7 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess public function testMethodIsvalidHasResultBooleanFalseIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndTheNewUserMatchesNeitherTheCurrentUserMailAndUid() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('mail@example.org')); @@ -141,7 +141,7 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess public function testMethodIsvalidHasResultBooleanTrueIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndTheNewUserMatchesEitherTheCurrentUserMailAndUid() { - $auth = $this->getMock('Horde_Kolab_Session_Auth'); + $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); $auth->expects($this->once()) ->method('getCurrentUser') ->will($this->returnValue('mail@example.org')); diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/SessionTestCase.php b/framework/Kolab_Session/test/Horde/Kolab/Session/SessionTestCase.php index c74404f09..a8dcee447 100644 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/SessionTestCase.php +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/SessionTestCase.php @@ -50,13 +50,13 @@ class Horde_Kolab_Session_SessionTestCase extends PHPUnit_Framework_TestCase protected function setupStorage() { - $this->storage = $this->getMock('Horde_Kolab_Session_Storage'); + $this->storage = $this->getMock('Horde_Kolab_Session_Storage_Interface'); } protected function setupFactoryMocks() { $this->server = $this->_getMockedComposite(); - $this->session_auth = $this->getMock('Horde_Kolab_Session_Auth'); - $this->session_storage = $this->getMock('Horde_Kolab_Session_Storage'); + $this->session_auth = $this->getMock('Horde_Kolab_Session_Auth_Interface'); + $this->session_storage = $this->getMock('Horde_Kolab_Session_Storage_Interface'); } } \ No newline at end of file -- 2.11.0