Rename interfaces and decorators.
authorGunnar Wrobel <p@rdus.de>
Thu, 5 Nov 2009 22:35:50 +0000 (23:35 +0100)
committerGunnar Wrobel <p@rdus.de>
Thu, 5 Nov 2009 22:35:50 +0000 (23:35 +0100)
57 files changed:
framework/Kolab_Session/lib/Horde/Kolab/Session.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Anonymous.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Auth.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Horde.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Interface.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Mock.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Factory.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Anonymous.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Base.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Configuration.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Constructor.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Anonymous.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Logged.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Interface.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Logged.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Interface.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Logged.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Storage.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Interface.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Mock.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Sessionobjects.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Stored.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Valid.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Base.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Decorator/Logged.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Interface.php [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Logged.php [deleted file]
framework/Kolab_Session/package.xml
framework/Kolab_Session/test/Horde/Kolab/Session/Class/AnonymousTest.php [deleted file]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php [new file with mode: 0644]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php [new file with mode: 0644]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php [new file with mode: 0644]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/AnonymousTest.php [deleted file]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/BaseTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConfigurationTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/ConstructorTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/AnonymousTest.php [new file with mode: 0644]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/LoggedTest.php [new file with mode: 0644]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/DefaultTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/InjectorTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/LoggedTest.php [deleted file]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/LoggedTest.php [deleted file]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/MockTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/StoredTest.php [deleted file]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/BaseTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/Decorator/LoggedTest.php [new file with mode: 0644]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/LoggedTest.php [deleted file]
framework/Kolab_Session/test/Horde/Kolab/Session/Integration/AnonymousTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SessionTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SingletonTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Integration/ValidTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/SessionTestCase.php

diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session.php b/framework/Kolab_Session/lib/Horde/Kolab/Session.php
deleted file mode 100644 (file)
index f36a04a..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-/**
- * The interface describing Horde_Kolab_Session handlers.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * The interface describing Horde_Kolab_Session handlers.
- *
- * Horde_Kolab_Server currently has no caching so we mainly cache some core user
- * information in the Kolab session handler as reading this data is expensive
- * and it is sufficient to read it once per session.
- *
- * The core user credentials (login, pass) are kept within the Auth module and
- * can be retrieved using <code>Auth::getAuth()</code> respectively
- * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
- * relevant for the user session should be accessed via the Horde_Kolab_Session
- * class.
- *
- * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-interface Horde_Kolab_Session
-{
-    /**
-     * Try to connect the session handler.
-     *
-     * @param array $credentials An array of login credentials. For Kolab,
-     *                           this must contain a "password" entry.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Session_Exception If the connection failed.
-     */
-    public function connect(array $credentials = null);
-
-    /**
-     * Return the user id used for connecting the session.
-     *
-     * @return string The user id.
-     */
-    public function getId();
-
-    /**
-     * Set the user id used for connecting the session.
-     *
-     * @param string $id The user id.
-     *
-     * @return NULL
-     */
-    public function setId($id);
-
-    /**
-     * Return the users mail address.
-     *
-     * @return string The users mail address.
-     */
-    public function getMail();
-
-    /**
-     * Return the users uid.
-     *
-     * @return string The users uid.
-     */
-    public function getUid();
-
-    /**
-     * Return the users name.
-     *
-     * @return string The users name.
-     */
-    public function getName();
-
-    /**
-     * Return the imap server.
-     *
-     * @return string The imap host for the current user.
-     */
-    public function getImapServer();
-
-    /**
-     * Return the freebusy server.
-     *
-     * @return string The freebusy host for the current user.
-     */
-    public function getFreebusyServer();
-
-    /**
-     * Return a connection to the Kolab storage system.
-     *
-     * @return Horde_Kolab_Storage The storage connection.
-     */
-    public function getStorage();
-}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Anonymous.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Anonymous.php
deleted file mode 100644 (file)
index 9c046a6..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-/**
- * The Horde_Kolab_Session_Anonymous class allows anonymous access to the Kolab
- * system.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * The Horde_Kolab_Session_Anonymous class allows anonymous access to the Kolab
- * system.
- *
- * The core user credentials (login, pass) are kept within the Auth module and
- * can be retrieved using <code>Auth::getAuth()</code> respectively
- * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
- * relevant for the user session should be accessed via the Horde_Kolab_Session
- * class.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    /**
-     * The session handler this instance provides with anonymous access.
-     *
-     * @var Horde_Kolab_Session
-     */
-    private $_session;
-
-    /**
-     * Anonymous user ID.
-     *
-     * @var string
-     */
-    private $_anonymous_id;
-
-    /**
-     * Anonymous password.
-     *
-     * @var string
-     */
-    private $_anonymous_pass;
-
-    /**
-     * 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.
-     */
-    public function __construct(Horde_Kolab_Session $session, $user, $pass)
-    {
-        $this->_session        = $session;
-        $this->_anonymous_id   = $user;
-        $this->_anonymous_pass = $pass;
-    }
-
-    /**
-     * Try to connect the session handler.
-     *
-     * @param array $credentials An array of login credentials. For Kolab,
-     *                           this must contain a "password" entry.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Session_Exception If the connection failed.
-     */
-    public function connect(array $credentials = null)
-    {
-        $id = $this->_session->getId();
-        if (empty($id) && $credentials === null) {
-            $this->_session->setId($this->_anonymous_id);
-            $this->_session->connect(array('password' => $this->_anonymous_pass));
-        } else {
-            $this->_session->connect($credentials);
-        }
-    }
-
-    /**
-     * Return the user id used for connecting the session.
-     *
-     * @return string The user id.
-     */
-    public function getId()
-    {
-        $id = $this->_session->getId();
-        if ($id == $this->_anonymous_id) {
-            return null;
-        }
-        return $id;
-    }
-
-    /**
-     * Set the user id used for connecting the session.
-     *
-     * @param string $id The user id.
-     *
-     * @return NULL
-     */
-    public function setId($id)
-    {
-        $this->_session->setId($id);
-    }
-
-    /**
-     * Return the users mail address.
-     *
-     * @return string The users mail address.
-     */
-    public function getMail()
-    {
-        return $this->_session->getMail();
-    }
-
-    /**
-     * Return the users uid.
-     *
-     * @return string The users uid.
-     */
-    public function getUid()
-    {
-        return $this->_session->getUid();
-    }
-
-    /**
-     * Return the users name.
-     *
-     * @return string The users name.
-     */
-    public function getName()
-    {
-        return $this->_session->getName();
-    }
-
-    /**
-     * Return the imap server.
-     *
-     * @return string The imap host for the current user.
-     */
-    public function getImapServer()
-    {
-        return $this->_session->getImapServer();
-    }
-
-    /**
-     * Return the freebusy server.
-     *
-     * @return string The freebusy host for the current user.
-     */
-    public function getFreebusyServer()
-    {
-        return $this->_session->getFreebusyServer();
-    }
-
-    /**
-     * Return a connection to the Kolab storage system.
-     *
-     * @return Horde_Kolab_Storage The storage connection.
-     *
-     * @todo Adapt to new structure of this class.
-     */
-    public function getStorage()
-    {
-        return $this->_session->getStorage();
-    }
-}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth.php
deleted file mode 100644 (file)
index 1f0ab1f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Defines an authentication wrapper for the Kolab session information.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Defines an authentication wrapper for the Kolab session information.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-interface Horde_Kolab_Session_Auth
-{
-    /**
-     * Get the current user ID.
-     *
-     * @return string The ID of the current user.
-     */
-    public function getCurrentUser();
-}
index 31d0901..8401d74 100644 (file)
@@ -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/Interface.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Interface.php
new file mode 100644 (file)
index 0000000..46a64bd
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Defines an authentication wrapper for the Kolab session information.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Defines an authentication wrapper for the Kolab session information.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @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
+{
+    /**
+     * Get the current user ID.
+     *
+     * @return string The ID of the current user.
+     */
+    public function getCurrentUser();
+}
index bf08936..bc39dc4 100644 (file)
@@ -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.
index f9b8230..1aeb63e 100644 (file)
@@ -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/Decorator/Anonymous.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php
new file mode 100644 (file)
index 0000000..75ba38a
--- /dev/null
@@ -0,0 +1,186 @@
+<?php
+/**
+ * The Horde_Kolab_Session_Anonymous class allows anonymous access to the Kolab
+ * system.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * The Horde_Kolab_Session_Anonymous class allows anonymous access to the Kolab
+ * system.
+ *
+ * The core user credentials (login, pass) are kept within the Auth module and
+ * can be retrieved using <code>Auth::getAuth()</code> respectively
+ * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
+ * relevant for the user session should be accessed via the Horde_Kolab_Session
+ * class.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=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_Interface
+     */
+    private $_session;
+
+    /**
+     * Anonymous user ID.
+     *
+     * @var string
+     */
+    private $_anonymous_id;
+
+    /**
+     * Anonymous password.
+     *
+     * @var string
+     */
+    private $_anonymous_pass;
+
+    /**
+     * Constructor.
+     *
+     * @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_Interface $session,
+        $user,
+        $pass
+    ) {
+        $this->_session        = $session;
+        $this->_anonymous_id   = $user;
+        $this->_anonymous_pass = $pass;
+    }
+
+    /**
+     * Try to connect the session handler.
+     *
+     * @param array $credentials An array of login credentials. For Kolab,
+     *                           this must contain a "password" entry.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Session_Exception If the connection failed.
+     */
+    public function connect(array $credentials = null)
+    {
+        $id = $this->_session->getId();
+        if (empty($id) && $credentials === null) {
+            $this->_session->setId($this->_anonymous_id);
+            $this->_session->connect(array('password' => $this->_anonymous_pass));
+        } else {
+            $this->_session->connect($credentials);
+        }
+    }
+
+    /**
+     * Return the user id used for connecting the session.
+     *
+     * @return string The user id.
+     */
+    public function getId()
+    {
+        $id = $this->_session->getId();
+        if ($id == $this->_anonymous_id) {
+            return null;
+        }
+        return $id;
+    }
+
+    /**
+     * Set the user id used for connecting the session.
+     *
+     * @param string $id The user id.
+     *
+     * @return NULL
+     */
+    public function setId($id)
+    {
+        $this->_session->setId($id);
+    }
+
+    /**
+     * Return the users mail address.
+     *
+     * @return string The users mail address.
+     */
+    public function getMail()
+    {
+        return $this->_session->getMail();
+    }
+
+    /**
+     * Return the users uid.
+     *
+     * @return string The users uid.
+     */
+    public function getUid()
+    {
+        return $this->_session->getUid();
+    }
+
+    /**
+     * Return the users name.
+     *
+     * @return string The users name.
+     */
+    public function getName()
+    {
+        return $this->_session->getName();
+    }
+
+    /**
+     * Return the imap server.
+     *
+     * @return string The imap host for the current user.
+     */
+    public function getImapServer()
+    {
+        return $this->_session->getImapServer();
+    }
+
+    /**
+     * Return the freebusy server.
+     *
+     * @return string The freebusy host for the current user.
+     */
+    public function getFreebusyServer()
+    {
+        return $this->_session->getFreebusyServer();
+    }
+
+    /**
+     * Return a connection to the Kolab storage system.
+     *
+     * @return Horde_Kolab_Storage The storage connection.
+     *
+     * @todo Adapt to new structure of this class.
+     */
+    public function getStorage()
+    {
+        return $this->_session->getStorage();
+    }
+}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php
new file mode 100644 (file)
index 0000000..10310f6
--- /dev/null
@@ -0,0 +1,174 @@
+<?php
+/**
+ * A logger for Horde_Kolab_Session handlers.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * A logger for Horde_Kolab_Session handlers.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+class Horde_Kolab_Session_Decorator_Logged
+implements Horde_Kolab_Session_Interface
+{
+    /**
+     * The session handler.
+     *
+     * @var Horde_Kolab_Session_Interface
+     */
+    private $_session;
+
+    /**
+     * The logger.
+     *
+     * @var mixed
+     */
+    private $_logger;
+
+    /**
+     * Constructor.
+     *
+     * The provided logger class needs to implement the methods info() and
+     * err().
+     *
+     * @param Horde_Kolab_Session_Interface $session The session handler.
+     * @param mixed                         $logger  The logger instance.
+     */
+    public function __construct(
+        Horde_Kolab_Session_Interface $session,
+        $logger
+    ) {
+        $this->_session = $session;
+        $this->_logger  = $logger;
+    }
+
+    /**
+     * Try to connect the session handler.
+     *
+     * @param array $credentials An array of login credentials. For Kolab,
+     *                           this must contain a "password" entry.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Session_Exception If the connection failed.
+     */
+    public function connect(array $credentials = null)
+    {
+        try {
+            $this->_session->connect($credentials);
+            $this->_logger->info(
+                sprintf(
+                    "Connected Kolab session for \"%s\".",
+                    $this->_session->getId()
+                )
+            );
+        } catch (Horde_Kolab_Session_Exception $e) {
+            $this->_logger->err(
+                sprintf(
+                    "Failed to connect Kolab session for \"%s\". Error was: %s",
+                    $this->_session->getId(), $e->getMessage()
+                )
+            );
+            throw $e;
+        }
+    }
+
+    /**
+     * Return the user id used for connecting the session.
+     *
+     * @return string The user id.
+     */
+    public function getId()
+    {
+        return $this->_session->getId();
+    }
+
+    /**
+     * Set the user id used for connecting the session.
+     *
+     * @param string $id The user id.
+     *
+     * @return NULL
+     */
+    public function setId($id)
+    {
+        $this->_session->setId($id);
+    }
+
+    /**
+     * Return the users mail address.
+     *
+     * @return string The users mail address.
+     */
+    public function getMail()
+    {
+        return $this->_session->getMail();
+    }
+
+    /**
+     * Return the users uid.
+     *
+     * @return string The users uid.
+     */
+    public function getUid()
+    {
+        return $this->_session->getUid();
+    }
+
+    /**
+     * Return the users name.
+     *
+     * @return string The users name.
+     */
+    public function getName()
+    {
+        return $this->_session->getName();
+    }
+
+    /**
+     * Return the imap server.
+     *
+     * @return string The imap host for the current user.
+     */
+    public function getImapServer()
+    {
+        return $this->_session->getImapServer();
+    }
+
+    /**
+     * Return the freebusy server.
+     *
+     * @return string The freebusy host for the current user.
+     */
+    public function getFreebusyServer()
+    {
+        return $this->_session->getFreebusyServer();
+    }
+
+    /**
+     * Return a connection to the Kolab storage system.
+     *
+     * @return Horde_Kolab_Storage The storage connection.
+     */
+    public function getStorage()
+    {
+        return $this->_session->getStorage();
+    }
+}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php
new file mode 100644 (file)
index 0000000..134a3e2
--- /dev/null
@@ -0,0 +1,171 @@
+<?php
+/**
+ * Storage for Horde_Kolab_Session handlers.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Storage for Horde_Kolab_Session handlers.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+class Horde_Kolab_Session_Decorator_Stored
+implements Horde_Kolab_Session_Interface
+{
+    /**
+     * The session handler.
+     *
+     * @var Horde_Kolab_Session_Interface
+     */
+    private $_session;
+
+    /**
+     * The storage.
+     *
+     * @var Horde_Kolab_Session_Storage
+     */
+    private $_storage;
+
+    /**
+     * Has the storage been connected successfully?
+     *
+     * @var boolean
+     */
+    private $_connected = false;
+
+    /**
+     * Constructor.
+     *
+     * @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_Interface $session,
+        Horde_Kolab_Session_Storage_Interface $storage
+    ) {
+        $this->_session = $session;
+        $this->_storage = $storage;
+    }
+
+    /**
+     * Destructor.
+     *
+     * Save the session in the storage on shutdown.
+     */
+    public function __destruct()
+    {
+        $this->_storage->save($this->_session);
+    }
+
+    /**
+     * Try to connect the session handler.
+     *
+     * @param array $credentials An array of login credentials. For Kolab,
+     *                           this must contain a "password" entry.
+     *
+     * @return NULL
+     */
+    public function connect(array $credentials = null)
+    {
+        $this->_session->connect($credentials);
+        $this->_connected = true;
+    }
+
+    /**
+     * Return the user id used for connecting the session.
+     *
+     * @return string The user id.
+     */
+    public function getId()
+    {
+        return $this->_session->getId();
+    }
+
+    /**
+     * Set the user id used for connecting the session.
+     *
+     * @param string $id The user id.
+     *
+     * @return NULL
+     */
+    public function setId($id)
+    {
+        $this->_session->setId($id);
+    }
+
+    /**
+     * Return the users mail address.
+     *
+     * @return string The users mail address.
+     */
+    public function getMail()
+    {
+        return $this->_session->getMail();
+    }
+
+    /**
+     * Return the users uid.
+     *
+     * @return string The users uid.
+     */
+    public function getUid()
+    {
+        return $this->_session->getUid();
+    }
+
+    /**
+     * Return the users name.
+     *
+     * @return string The users name.
+     */
+    public function getName()
+    {
+        return $this->_session->getName();
+    }
+
+    /**
+     * Return the imap server.
+     *
+     * @return string The imap host for the current user.
+     */
+    public function getImapServer()
+    {
+        return $this->_session->getImapServer();
+    }
+
+    /**
+     * Return the freebusy server.
+     *
+     * @return string The freebusy host for the current user.
+     */
+    public function getFreebusyServer()
+    {
+        return $this->_session->getFreebusyServer();
+    }
+
+    /**
+     * Return a connection to the Kolab storage system.
+     *
+     * @return Horde_Kolab_Storage The storage connection.
+     */
+    public function getStorage()
+    {
+        return $this->_session->getStorage();
+    }
+}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory.php
deleted file mode 100644 (file)
index 9fdba64..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-/**
- * Interface for Horde_Kolab_Session factories.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Interface for Horde_Kolab_Session factories.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-interface Horde_Kolab_Session_Factory
-{
-    /**
-     * Return the kolab user db connection.
-     *
-     * @return Horde_Kolab_Server The server connection.
-     */
-    public function getServer();
-
-    /**
-     * Return the auth handler for sessions.
-     *
-     * @return Horde_Kolab_Session_Auth The authentication handler.
-     */
-    public function getSessionAuth();
-
-    /**
-     * Return the configuration parameters for the session.
-     *
-     * @return array The configuration values.
-     */
-    public function getSessionConfiguration();
-
-    /**
-     * Return the session storage driver.
-     *
-     * @return Horde_Kolab_Session_Storage 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.
-     *
-     * @return Horde_Kolab_Session_Valid The driver for validating sessions.
-     */
-    public function getSessionValidator(
-        Horde_Kolab_Session $session,
-        Horde_Kolab_Session_Auth $auth
-    );
-
-    /**
-     * Validate the given session.
-     *
-     * 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.
-     *
-     * @return boolean True if the given session is valid.
-     */
-    public function validate(Horde_Kolab_Session $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.
-     */
-    public function createSession($user = null);
-
-    /**
-     * Returns either a reference to a session handler with data retrieved from
-     * the session or a new session handler.
-     *
-     * @param string $user        The session will be setup for the user with
-     *                            this ID.
-     * @param array  $credentials An array of login credentials.
-     *
-     * @return Horde_Kolab_Session The concrete Kolab session reference.
-     */
-    public function getSession($user = null, array $credentials = null);
-}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Anonymous.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Anonymous.php
deleted file mode 100644 (file)
index 85f5081..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-/**
- * A factory decorator that adds an anonymous user to the generated instances.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * A factory decorator that adds an anonymous user to the generated instances.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    /**
-     * The factory setup resulting from the configuration.
-     *
-     * @var Horde_Kolab_Session_Factory
-     */
-    private $_factory;
-
-    /**
-     * Anonymous user ID.
-     *
-     * @var string
-     */
-    private $_anonymous_id;
-
-    /**
-     * Anonymous password.
-     *
-     * @var string
-     */
-    private $_anonymous_pass;
-
-    /**
-     * 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.
-     */
-    public function __construct(
-        Horde_Kolab_Session_Factory $factory,
-        $user,
-        $pass
-    ) {
-        $this->_factory        = $factory;
-        $this->_anonymous_id   = $user;
-        $this->_anonymous_pass = $pass;
-    }
-
-    /**
-     * Return the kolab user db connection.
-     *
-     * @return Horde_Kolab_Server The server connection.
-     */
-    public function getServer()
-    {
-        return $this->_factory->getServer();
-    }
-
-    /**
-     * Return the auth handler for sessions.
-     *
-     * @return Horde_Kolab_Session_Auth The authentication handler.
-     */
-    public function getSessionAuth()
-    {
-        return $this->_factory->getSessionAuth();
-    }
-
-    /**
-     * Return the configuration parameters for the session.
-     *
-     * @return array The configuration values.
-     */
-    public function getSessionConfiguration()
-    {
-        return $this->_factory->getSessionConfiguration();
-    }
-
-    /**
-     * Return the session storage driver.
-     *
-     * @return Horde_Kolab_Session_Storage The driver for storing sessions.
-     */
-    public function getSessionStorage()
-    {
-        return $this->_factory->getSessionStorage();
-    }
-
-    /**
-     * Return the session validation driver.
-     *
-     * @param Horde_Kolab_Session      $session The session to validate.
-     * @param Horde_Kolab_Session_Auth $auth    The auth handler.
-     *
-     * @return Horde_Kolab_Session_Valid The driver for validating sessions.
-     */
-    public function getSessionValidator(
-        Horde_Kolab_Session $session,
-        Horde_Kolab_Session_Auth $auth
-    ) {
-        return $this->_factory->getSessionValidator($session, $auth);
-    }
-
-    /**
-     * 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.
-     *
-     * @return boolean True if thxe given session is valid.
-     */
-    public function validate(Horde_Kolab_Session $session, $user = null)
-    {
-        return $this->_factory->validate($session, $user);
-    }
-
-    /**
-     * 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.
-     */
-    public function createSession($user = null)
-    {
-        $session = $this->_factory->createSession($user);
-        $session = new Horde_Kolab_Session_Anonymous(
-            $session,
-            $this->_anonymous_id,
-            $this->_anonymous_pass
-        );
-        return $session;
-    }
-
-    /**
-     * Returns either a reference to a session handler with data retrieved from
-     * the session or a new session handler.
-     *
-     * @param string $user        The session will be setup for the user with
-     *                            this ID.
-     * @param array  $credentials An array of login credentials.
-     *
-     * @return Horde_Kolab_Session The concrete Kolab session reference.
-     */
-    public function getSession($user = null, array $credentials = null)
-    {
-        return $this->_factory->getSession($user, $credentials);
-    }
-}
index e995107..2ddf230 100644 (file)
  * @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()
         );
index 8fa9930..0869ee3 100644 (file)
@@ -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);
     }
index df50a24..22fd5aa 100644 (file)
@@ -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/Decorator/Anonymous.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Anonymous.php
new file mode 100644 (file)
index 0000000..6dabf78
--- /dev/null
@@ -0,0 +1,175 @@
+<?php
+/**
+ * A factory decorator that adds an anonymous user to the generated instances.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * A factory decorator that adds an anonymous user to the generated instances.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+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_Interface
+     */
+    private $_factory;
+
+    /**
+     * Anonymous user ID.
+     *
+     * @var string
+     */
+    private $_anonymous_id;
+
+    /**
+     * Anonymous password.
+     *
+     * @var string
+     */
+    private $_anonymous_pass;
+
+    /**
+     * Constructor.
+     *
+     * @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_Interface $factory,
+        $user,
+        $pass
+    ) {
+        $this->_factory        = $factory;
+        $this->_anonymous_id   = $user;
+        $this->_anonymous_pass = $pass;
+    }
+
+    /**
+     * Return the kolab user db connection.
+     *
+     * @return Horde_Kolab_Server_Interface The server connection.
+     */
+    public function getServer()
+    {
+        return $this->_factory->getServer();
+    }
+
+    /**
+     * Return the auth handler for sessions.
+     *
+     * @return Horde_Kolab_Session_Auth_Interface The authentication handler.
+     */
+    public function getSessionAuth()
+    {
+        return $this->_factory->getSessionAuth();
+    }
+
+    /**
+     * Return the configuration parameters for the session.
+     *
+     * @return array The configuration values.
+     */
+    public function getSessionConfiguration()
+    {
+        return $this->_factory->getSessionConfiguration();
+    }
+
+    /**
+     * Return the session storage driver.
+     *
+     * @return Horde_Kolab_Session_Storage_Interface The driver for storing sessions.
+     */
+    public function getSessionStorage()
+    {
+        return $this->_factory->getSessionStorage();
+    }
+
+    /**
+     * Return the session validation driver.
+     *
+     * @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_Interface The driver for validating
+     *                                             sessions.
+     */
+    public function getSessionValidator(
+        Horde_Kolab_Session_Interface $session,
+        Horde_Kolab_Session_Auth_Interface $auth
+    ) {
+        return $this->_factory->getSessionValidator($session, $auth);
+    }
+
+    /**
+     * Validate the given session.
+     *
+     * @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_Interface $session,
+        $user = null
+    ) {
+        return $this->_factory->validate($session, $user);
+    }
+
+    /**
+     * Returns a new session handler.
+     *
+     * @param string $user The session will be setup for the user with this ID.
+     *
+     * @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_Decorator_Anonymous(
+            $session,
+            $this->_anonymous_id,
+            $this->_anonymous_pass
+        );
+        return $session;
+    }
+
+    /**
+     * Returns either a reference to a session handler with data retrieved from
+     * the session or a new session handler.
+     *
+     * @param string $user        The session will be setup for the user with
+     *                            this ID.
+     * @param array  $credentials An array of login credentials.
+     *
+     * @return Horde_Kolab_Session_Interface The concrete Kolab session reference.
+     */
+    public function getSession($user = null, array $credentials = null)
+    {
+        return $this->_factory->getSession($user, $credentials);
+    }
+}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Logged.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Decorator/Logged.php
new file mode 100644 (file)
index 0000000..5296712
--- /dev/null
@@ -0,0 +1,165 @@
+<?php
+/**
+ * A factory decorator that adds logging to the generated instances.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * A factory decorator that adds logging to the generated instances.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+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_Interface
+     */
+    private $_factory;
+
+    /**
+     * The logger.
+     *
+     * @var mixed
+     */
+    private $_logger;
+
+    /**
+     * Constructor.
+     *
+     * @param Horde_Kolab_Session_Factory_Interface $factory The base factory.
+     * @param mixed                                 $logger  The logger isntance.
+     */
+    public function __construct(
+        Horde_Kolab_Session_Factory_Interface $factory,
+        $logger
+    ) {
+        $this->_factory = $factory;
+        $this->_logger  = $logger;
+    }
+
+    /**
+     * Return the kolab user db connection.
+     *
+     * @return Horde_Kolab_Server_Interface The server connection.
+     */
+    public function getServer()
+    {
+        return $this->_factory->getServer();
+    }
+
+    /**
+     * Return the auth handler for sessions.
+     *
+     * @return Horde_Kolab_Session_Auth_Interface The authentication handler.
+     */
+    public function getSessionAuth()
+    {
+        return $this->_factory->getSessionAuth();
+    }
+
+    /**
+     * Return the configuration parameters for the session.
+     *
+     * @return array The configuration values.
+     */
+    public function getSessionConfiguration()
+    {
+        return $this->_factory->getSessionConfiguration();
+    }
+
+    /**
+     * Return the session storage driver.
+     *
+     * @return Horde_Kolab_Session_Storage_Interface The driver for storing sessions.
+     */
+    public function getSessionStorage()
+    {
+        return $this->_factory->getSessionStorage();
+    }
+
+    /**
+     * Return the session validation driver.
+     *
+     * @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_Interface The driver for validating
+     *                                             sessions.
+     */
+    public function getSessionValidator(
+        Horde_Kolab_Session_Interface $session,
+        Horde_Kolab_Session_Auth_Interface $auth
+    ) {
+        $valid = $this->_factory->getSessionValidator($session, $auth);
+        $valid = new Horde_Kolab_Session_Valid_Decorator_Logged(
+            $valid, $this->_logger
+        );
+        return $valid;
+    }
+
+    /**
+     * Validate the given session.
+     *
+     * @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_Interface $session,
+        $user = null
+    ) {
+        return $this->_factory->validate($session, $user);
+    }
+
+    /**
+     * Returns a new session handler.
+     *
+     * @param string $user The session will be setup for the user with this ID.
+     *
+     * @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_Decorator_Logged(
+            $session, $this->_logger
+        );
+        return $session;
+    }
+
+    /**
+     * Returns either a reference to a session handler with data retrieved from
+     * the session or a new session handler.
+     *
+     * @param string $user        The session will be setup for the user with
+     *                            this ID.
+     * @param array  $credentials An array of login credentials.
+     *
+     * @return Horde_Kolab_Session_Interface The concrete Kolab session reference.
+     */
+    public function getSession($user = null, array $credentials = null)
+    {
+        return $this->_factory->getSession($user, $credentials);
+    }
+}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Interface.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Factory/Interface.php
new file mode 100644 (file)
index 0000000..ecb592a
--- /dev/null
@@ -0,0 +1,108 @@
+<?php
+/**
+ * Interface for Horde_Kolab_Session factories.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Interface for Horde_Kolab_Session factories.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @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
+{
+    /**
+     * Return the kolab user db connection.
+     *
+     * @return Horde_Kolab_Server_Interface The server connection.
+     */
+    public function getServer();
+
+    /**
+     * Return the auth handler for sessions.
+     *
+     * @return Horde_Kolab_Session_Auth_Interface The authentication handler.
+     */
+    public function getSessionAuth();
+
+    /**
+     * Return the configuration parameters for the session.
+     *
+     * @return array The configuration values.
+     */
+    public function getSessionConfiguration();
+
+    /**
+     * Return the session storage driver.
+     *
+     * @return Horde_Kolab_Session_Storage_Interface The driver for storing sessions.
+     */
+    public function getSessionStorage();
+
+    /**
+     * Return the session validation driver.
+     *
+     * @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_Interface The driver for validating
+     *                                             sessions.
+     */
+    public function getSessionValidator(
+        Horde_Kolab_Session_Interface $session,
+        Horde_Kolab_Session_Auth_Interface $auth
+    );
+
+    /**
+     * Validate the given session.
+     *
+     * Validate the given session.
+     *
+     * @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_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_Interface The concrete Kolab session reference.
+     */
+    public function createSession($user = null);
+
+    /**
+     * Returns either a reference to a session handler with data retrieved from
+     * the session or a new session handler.
+     *
+     * @param string $user        The session will be setup for the user with
+     *                            this ID.
+     * @param array  $credentials An array of login credentials.
+     *
+     * @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/Logged.php
deleted file mode 100644 (file)
index c398ebf..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-<?php
-/**
- * A factory decorator that adds logging to the generated instances.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * A factory decorator that adds logging to the generated instances.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    /**
-     * The factory setup resulting from the configuration.
-     *
-     * @var Horde_Kolab_Session_Factory
-     */
-    private $_factory;
-
-    /**
-     * The logger.
-     *
-     * @var mixed
-     */
-    private $_logger;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Kolab_Session_Factory $factory The base factory.
-     * @param mixed                       $logger  The logger isntance.
-     */
-    public function __construct(Horde_Kolab_Session_Factory $factory, $logger)
-    {
-        $this->_factory = $factory;
-        $this->_logger  = $logger;
-    }
-
-    /**
-     * Return the kolab user db connection.
-     *
-     * @return Horde_Kolab_Server The server connection.
-     */
-    public function getServer()
-    {
-        return $this->_factory->getServer();
-    }
-
-    /**
-     * Return the auth handler for sessions.
-     *
-     * @return Horde_Kolab_Session_Auth The authentication handler.
-     */
-    public function getSessionAuth()
-    {
-        return $this->_factory->getSessionAuth();
-    }
-
-    /**
-     * Return the configuration parameters for the session.
-     *
-     * @return array The configuration values.
-     */
-    public function getSessionConfiguration()
-    {
-        return $this->_factory->getSessionConfiguration();
-    }
-
-    /**
-     * Return the session storage driver.
-     *
-     * @return Horde_Kolab_Session_Storage The driver for storing sessions.
-     */
-    public function getSessionStorage()
-    {
-        return $this->_factory->getSessionStorage();
-    }
-
-    /**
-     * Return the session validation driver.
-     *
-     * @param Horde_Kolab_Session      $session The session to validate.
-     * @param Horde_Kolab_Session_Auth $auth    The auth handler.
-     *
-     * @return Horde_Kolab_Session_Valid The driver for validating sessions.
-     */
-    public function getSessionValidator(
-        Horde_Kolab_Session $session,
-        Horde_Kolab_Session_Auth $auth
-    ) {
-        $valid = $this->_factory->getSessionValidator($session, $auth);
-        $valid = new Horde_Kolab_Session_Valid_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.
-     *
-     * @return boolean True if thxe given session is valid.
-     */
-    public function validate(Horde_Kolab_Session $session, $user = null)
-    {
-        return $this->_factory->validate($session, $user);
-    }
-
-    /**
-     * 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.
-     */
-    public function createSession($user = null)
-    {
-        $session = $this->_factory->createSession($user);
-        $session = new Horde_Kolab_Session_Logged($session, $this->_logger);
-        return $session;
-    }
-
-    /**
-     * Returns either a reference to a session handler with data retrieved from
-     * the session or a new session handler.
-     *
-     * @param string $user        The session will be setup for the user with
-     *                            this ID.
-     * @param array  $credentials An array of login credentials.
-     *
-     * @return Horde_Kolab_Session The concrete Kolab session reference.
-     */
-    public function getSession($user = null, array $credentials = null)
-    {
-        return $this->_factory->getSession($user, $credentials);
-    }
-}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Interface.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Interface.php
new file mode 100644 (file)
index 0000000..2c42259
--- /dev/null
@@ -0,0 +1,109 @@
+<?php
+/**
+ * The interface describing Horde_Kolab_Session handlers.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * The interface describing Horde_Kolab_Session handlers.
+ *
+ * Horde_Kolab_Server currently has no caching so we mainly cache some core user
+ * information in the Kolab session handler as reading this data is expensive
+ * and it is sufficient to read it once per session.
+ *
+ * The core user credentials (login, pass) are kept within the Auth module and
+ * can be retrieved using <code>Auth::getAuth()</code> respectively
+ * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
+ * relevant for the user session should be accessed via the Horde_Kolab_Session
+ * class.
+ *
+ * Copyright 2008-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+interface Horde_Kolab_Session_Interface
+{
+    /**
+     * Try to connect the session handler.
+     *
+     * @param array $credentials An array of login credentials. For Kolab,
+     *                           this must contain a "password" entry.
+     *
+     * @return NULL
+     *
+     * @throws Horde_Kolab_Session_Exception If the connection failed.
+     */
+    public function connect(array $credentials = null);
+
+    /**
+     * Return the user id used for connecting the session.
+     *
+     * @return string The user id.
+     */
+    public function getId();
+
+    /**
+     * Set the user id used for connecting the session.
+     *
+     * @param string $id The user id.
+     *
+     * @return NULL
+     */
+    public function setId($id);
+
+    /**
+     * Return the users mail address.
+     *
+     * @return string The users mail address.
+     */
+    public function getMail();
+
+    /**
+     * Return the users uid.
+     *
+     * @return string The users uid.
+     */
+    public function getUid();
+
+    /**
+     * Return the users name.
+     *
+     * @return string The users name.
+     */
+    public function getName();
+
+    /**
+     * Return the imap server.
+     *
+     * @return string The imap host for the current user.
+     */
+    public function getImapServer();
+
+    /**
+     * Return the freebusy server.
+     *
+     * @return string The freebusy host for the current user.
+     */
+    public function getFreebusyServer();
+
+    /**
+     * Return a connection to the Kolab storage system.
+     *
+     * @return Horde_Kolab_Storage The storage connection.
+     */
+    public function getStorage();
+}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Logged.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Logged.php
deleted file mode 100644 (file)
index bba8424..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-/**
- * A logger for Horde_Kolab_Session handlers.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * A logger for Horde_Kolab_Session handlers.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    /**
-     * The session handler.
-     *
-     * @var Horde_Kolab_Session
-     */
-    private $_session;
-
-    /**
-     * The logger.
-     *
-     * @var mixed
-     */
-    private $_logger;
-
-    /**
-     * Constructor.
-     *
-     * 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.
-     */
-    public function __construct(Horde_Kolab_Session $session, $logger)
-    {
-        $this->_session = $session;
-        $this->_logger  = $logger;
-    }
-
-    /**
-     * Try to connect the session handler.
-     *
-     * @param array $credentials An array of login credentials. For Kolab,
-     *                           this must contain a "password" entry.
-     *
-     * @return NULL
-     *
-     * @throws Horde_Kolab_Session_Exception If the connection failed.
-     */
-    public function connect(array $credentials = null)
-    {
-        try {
-            $this->_session->connect($credentials);
-            $this->_logger->info(
-                sprintf(
-                    "Connected Kolab session for \"%s\".",
-                    $this->_session->getId()
-                )
-            );
-        } catch (Horde_Kolab_Session_Exception $e) {
-            $this->_logger->err(
-                sprintf(
-                    "Failed to connect Kolab session for \"%s\". Error was: %s",
-                    $this->_session->getId(), $e->getMessage()
-                )
-            );
-            throw $e;
-        }
-    }
-
-    /**
-     * Return the user id used for connecting the session.
-     *
-     * @return string The user id.
-     */
-    public function getId()
-    {
-        return $this->_session->getId();
-    }
-
-    /**
-     * Set the user id used for connecting the session.
-     *
-     * @param string $id The user id.
-     *
-     * @return NULL
-     */
-    public function setId($id)
-    {
-        $this->_session->setId($id);
-    }
-
-    /**
-     * Return the users mail address.
-     *
-     * @return string The users mail address.
-     */
-    public function getMail()
-    {
-        return $this->_session->getMail();
-    }
-
-    /**
-     * Return the users uid.
-     *
-     * @return string The users uid.
-     */
-    public function getUid()
-    {
-        return $this->_session->getUid();
-    }
-
-    /**
-     * Return the users name.
-     *
-     * @return string The users name.
-     */
-    public function getName()
-    {
-        return $this->_session->getName();
-    }
-
-    /**
-     * Return the imap server.
-     *
-     * @return string The imap host for the current user.
-     */
-    public function getImapServer()
-    {
-        return $this->_session->getImapServer();
-    }
-
-    /**
-     * Return the freebusy server.
-     *
-     * @return string The freebusy host for the current user.
-     */
-    public function getFreebusyServer()
-    {
-        return $this->_session->getFreebusyServer();
-    }
-
-    /**
-     * Return a connection to the Kolab storage system.
-     *
-     * @return Horde_Kolab_Storage The storage connection.
-     */
-    public function getStorage()
-    {
-        return $this->_session->getStorage();
-    }
-}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage.php
deleted file mode 100644 (file)
index 5eab9a7..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * Defines storage containers for the Kolab session information.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Defines storage containers for the Kolab session information.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-interface Horde_Kolab_Session_Storage
-{
-    /**
-     * Load the session information.
-     *
-     * @return Horde_Kolab_Session|boolean The session information or false if
-     * it could not be loaded.
-     */
-    public function load();
-
-    /**
-     * Lave the session information.
-     *
-     * @param Horde_Kolab_Session $session The session information.
-     *
-     * @return NULL
-     */
-    public function save(Horde_Kolab_Session $session);
-}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Interface.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Interface.php
new file mode 100644 (file)
index 0000000..de9a7ef
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Defines storage containers for the Kolab session information.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Defines storage containers for the Kolab session information.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @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
+{
+    /**
+     * Load the session information.
+     *
+     * @return Horde_Kolab_Session|boolean The session information or false if
+     * it could not be loaded.
+     */
+    public function load();
+
+    /**
+     * Lave the session information.
+     *
+     * @param Horde_Kolab_Session $session The session information.
+     *
+     * @return NULL
+     */
+    public function save(Horde_Kolab_Session_Interface $session);
+}
index 4d3a415..de13c94 100644 (file)
@@ -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;
     }
index c7163fe..8d5128d 100644 (file)
@@ -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/Stored.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Stored.php
deleted file mode 100644 (file)
index c145590..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-/**
- * Storage for Horde_Kolab_Session handlers.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Storage for Horde_Kolab_Session handlers.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    /**
-     * The session handler.
-     *
-     * @var Horde_Kolab_Session
-     */
-    private $_session;
-
-    /**
-     * The storage.
-     *
-     * @var Horde_Kolab_Session_Storage
-     */
-    private $_storage;
-
-    /**
-     * Has the storage been connected successfully?
-     *
-     * @var boolean
-     */
-    private $_connected = false;
-
-    /**
-     * Constructor.
-     *
-     * @param Horde_Kolab_Session         $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
-    ) {
-        $this->_session = $session;
-        $this->_storage = $storage;
-    }
-
-    /**
-     * Destructor.
-     *
-     * Save the session in the storage on shutdown.
-     */
-    public function __destruct()
-    {
-        $this->_storage->save($this->_session);
-    }
-
-    /**
-     * Try to connect the session handler.
-     *
-     * @param array $credentials An array of login credentials. For Kolab,
-     *                           this must contain a "password" entry.
-     *
-     * @return NULL
-     */
-    public function connect(array $credentials = null)
-    {
-        $this->_session->connect($credentials);
-        $this->_connected = true;
-    }
-
-    /**
-     * Return the user id used for connecting the session.
-     *
-     * @return string The user id.
-     */
-    public function getId()
-    {
-        return $this->_session->getId();
-    }
-
-    /**
-     * Set the user id used for connecting the session.
-     *
-     * @param string $id The user id.
-     *
-     * @return NULL
-     */
-    public function setId($id)
-    {
-        $this->_session->setId($id);
-    }
-
-    /**
-     * Return the users mail address.
-     *
-     * @return string The users mail address.
-     */
-    public function getMail()
-    {
-        return $this->_session->getMail();
-    }
-
-    /**
-     * Return the users uid.
-     *
-     * @return string The users uid.
-     */
-    public function getUid()
-    {
-        return $this->_session->getUid();
-    }
-
-    /**
-     * Return the users name.
-     *
-     * @return string The users name.
-     */
-    public function getName()
-    {
-        return $this->_session->getName();
-    }
-
-    /**
-     * Return the imap server.
-     *
-     * @return string The imap host for the current user.
-     */
-    public function getImapServer()
-    {
-        return $this->_session->getImapServer();
-    }
-
-    /**
-     * Return the freebusy server.
-     *
-     * @return string The freebusy host for the current user.
-     */
-    public function getFreebusyServer()
-    {
-        return $this->_session->getFreebusyServer();
-    }
-
-    /**
-     * Return a connection to the Kolab storage system.
-     *
-     * @return Horde_Kolab_Storage The storage connection.
-     */
-    public function getStorage()
-    {
-        return $this->_session->getStorage();
-    }
-}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid.php
deleted file mode 100644 (file)
index a1c2fe8..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-/**
- * Interface for session validators.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Interface for session validators.
- *
- * The core user credentials (login, pass) are kept within the Auth module and
- * can be retrieved using <code>Auth::getAuth()</code> respectively
- * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
- * relevant for the user session should be accessed via the Horde_Kolab_Session
- * class.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-interface Horde_Kolab_Session_Valid
-{
-    /**
-     * Does the current session still match the authentication information?
-     *
-     * @param string $user The user the session information is being requested
-     *                     for. This is usually empty, indicating the current
-     *                     user.
-     *
-     * @return boolean True if the session is still valid.
-     */
-    public function isValid($user = null);
-
-    /**
-     * Return the session this validator checks.
-     *
-     * @return Horde_Kolab_Session 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.
-     */
-    public function getAuth();
-}
\ No newline at end of file
index 1e6be37..118cb2f 100644 (file)
  * @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/Decorator/Logged.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Decorator/Logged.php
new file mode 100644 (file)
index 0000000..bae5a80
--- /dev/null
@@ -0,0 +1,109 @@
+<?php
+/**
+ * A logger for Horde_Kolab_Session_Valid validators.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * A logger for Horde_Kolab_Session_Valid validators.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+class Horde_Kolab_Session_Valid_Decorator_Logged
+implements Horde_Kolab_Session_Valid_Interface
+{
+    /**
+     * The valid handler.
+     *
+     * @var Horde_Kolab_Session_Valid_Interface
+     */
+    private $_valid;
+
+    /**
+     * The logger.
+     *
+     * @var mixed
+     */
+    private $_logger;
+
+    /**
+     * Constructor.
+     *
+     * The provided logger class needs to implement the methods info() and
+     * err().
+     *
+     * @param Horde_Kolab_Session_Valid_Interface $valid  The validator.
+     * @param mixed                               $logger The logger instance.
+     */
+    public function __construct(
+        Horde_Kolab_Session_Valid_Interface $valid,
+        $logger
+    ) {
+        $this->_valid  = $valid;
+        $this->_logger = $logger;
+    }
+
+    /**
+     * Does the current session still match the authentication information?
+     *
+     * @param string $user The user the session information is being requested
+     *                     for. This is usually empty, indicating the current
+     *                     user.
+     *
+     * @return boolean True if the session is still valid.
+     */
+    public function isValid($user = null)
+    {
+        $result = $this->_valid->isValid($user);
+        if ($result === false) {
+            $this->_logger->info(
+                sprintf(
+                    "Invalid Kolab session for current user \"%s\", requested"
+                    . " user \"%s\" and stored user \"%s\".",
+                    $this->_valid->getAuth()->getCurrentUser(),
+                    $user,
+                    $this->_valid->getSession()->getMail()
+                )
+            );
+        }
+        return $result;
+    }
+
+    /**
+     * Return the session this validator checks.
+     *
+     * @return Horde_Kolab_Session_Interface The session checked by this
+     * validator.
+     */
+    public function getSession()
+    {
+        return $this->_valid->getSession();
+    }
+
+    /**
+     * Return the auth driver of this validator.
+     *
+     * @return Horde_Kolab_Session_Auth_Interface The auth driver set for this
+     * validator.
+     */
+    public function getAuth()
+    {
+        return $this->_valid->getAuth();
+    }
+}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Interface.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Interface.php
new file mode 100644 (file)
index 0000000..bb39914
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Interface for session validators.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Interface for session validators.
+ *
+ * The core user credentials (login, pass) are kept within the Auth module and
+ * can be retrieved using <code>Auth::getAuth()</code> respectively
+ * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
+ * relevant for the user session should be accessed via the Horde_Kolab_Session
+ * class.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @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
+{
+    /**
+     * Does the current session still match the authentication information?
+     *
+     * @param string $user The user the session information is being requested
+     *                     for. This is usually empty, indicating the current
+     *                     user.
+     *
+     * @return boolean True if the session is still valid.
+     */
+    public function isValid($user = null);
+
+    /**
+     * Return the session this validator checks.
+     *
+     * @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_Interface The auth driver set for this
+     * validator.
+     */
+    public function getAuth();
+}
\ No newline at end of file
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Logged.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Logged.php
deleted file mode 100644 (file)
index bb0f703..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-/**
- * A logger for Horde_Kolab_Session_Valid validators.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * A logger for Horde_Kolab_Session_Valid validators.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    /**
-     * The valid handler.
-     *
-     * @var Horde_Kolab_Session_Valid
-     */
-    private $_valid;
-
-    /**
-     * The logger.
-     *
-     * @var mixed
-     */
-    private $_logger;
-
-    /**
-     * Constructor.
-     *
-     * 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.
-     */
-    public function __construct(Horde_Kolab_Session_Valid $valid, $logger)
-    {
-        $this->_valid  = $valid;
-        $this->_logger = $logger;
-    }
-
-    /**
-     * Does the current session still match the authentication information?
-     *
-     * @param string $user The user the session information is being requested
-     *                     for. This is usually empty, indicating the current
-     *                     user.
-     *
-     * @return boolean True if the session is still valid.
-     */
-    public function isValid($user = null)
-    {
-        $result = $this->_valid->isValid($user);
-        if ($result === false) {
-            $this->_logger->info(
-                sprintf(
-                    "Invalid Kolab session for current user \"%s\", requested"
-                    . " user \"%s\" and stored user \"%s\".",
-                    $this->_valid->getAuth()->getCurrentUser(),
-                    $user,
-                    $this->_valid->getSession()->getMail()
-                )
-            );
-        }
-        return $result;
-    }
-
-    /**
-     * Return the session this validator checks.
-     *
-     * @return Horde_Kolab_Session The session checked by this validator.
-     */
-    public function getSession()
-    {
-        return $this->_valid->getSession();
-    }
-
-    /**
-     * Return the auth driver of this validator.
-     *
-     * @return Horde_Kolab_Session_Auth The auth driver set for this validator.
-     */
-    public function getAuth()
-    {
-        return $this->_valid->getAuth();
-    }
-}
index 5918bfa..000b693 100644 (file)
@@ -45,41 +45,47 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <dir name="lib">
     <dir name="Horde">
      <dir name="Kolab">
-      <file name="Session.php" role="php" />
       <dir name="Session">
-       <file name="Anonymous.php" role="php" />
-       <file name="Auth.php" role="php" />
        <dir name="Auth">
         <file name="Horde.php" role="php" />
+        <file name="Interface.php" role="php" />
         <file name="Mock.php" role="php" />
        </dir> <!-- /lib/Horde/Session/Auth -->
        <file name="Base.php" role="php" />
+       <dir name="Decorator">
+        <file name="Anonymous.php" role="php" />
+        <file name="Logged.php" role="php" />
+        <file name="Stored.php" role="php" />
+       </dir> <!-- /lib/Horde/Session/Decorator -->
        <file name="Exception.php" role="php" />
        <dir name="Exception">
         <file name="Badlogin.php" role="php" />
        </dir> <!-- /lib/Horde/Session/Exception -->
-       <file name="Factory.php" role="php" />
        <dir name="Factory">
-        <file name="Anonymous.php" role="php" />
         <file name="Base.php" role="php" />
         <file name="Configuration.php" role="php" />
         <file name="Constructor.php" role="php" />
+        <dir name="Decorator">
+         <file name="Anonymous.php" role="php" />
+         <file name="Logged.php" role="php" />
+        </dir> <!-- /lib/Horde/Session/Factory/Decorator -->
         <file name="Default.php" role="php" />
         <file name="Injector.php" role="php" />
-        <file name="Logged.php" role="php" />
+        <file name="Interface.php" role="php" />
        </dir> <!-- /lib/Horde/Session/Factory -->
-       <file name="Logged.php" role="php" />
+       <file name="Interface.php" role="php" />
        <file name="Singleton.php" role="php" />
-       <file name="Storage.php" role="php" />
        <dir name="Storage">
         <file name="Mock.php" role="php" />
+        <file name="Interface.php" role="php" />
         <file name="Sessionobjects.php" role="php" />
        </dir> <!-- /lib/Horde/Session/Storage -->
-       <file name="Stored.php" role="php" />
-       <file name="Valid.php" role="php" />
        <dir name="Valid">
         <file name="Base.php" role="php" />
-        <file name="Logged.php" role="php" />
+        <dir name="Decorator">
+         <file name="Logged.php" role="php" />
+        </dir> <!-- /lib/Horde/Session/Valid/Decorator -->
+        <file name="Interface.php" role="php" />
        </dir> <!-- /lib/Horde/Session/Valid -->
       </dir> <!-- /lib/Horde/Session -->
      </dir> <!-- /lib/Horde/Kolab -->
@@ -92,30 +98,36 @@ http://pear.php.net/dtd/package-2.0.xsd">
        <file name="AllTests.php" role="test" />
        <file name="Autoload.php" role="test" />
        <dir name="Class">
-        <file name="AnonymousTest.php" role="test" />
         <dir name="Auth">
          <file name="HordeTest.php" role="test" />
          <file name="MockTest.php" role="test" />
         </dir> <!-- /test/Horde/Kolab/Session/Class/Auth -->
         <file name="BaseTest.php" role="test" />
-        <dir name="Factory">
+        <dir name="Decorator">
          <file name="AnonymousTest.php" role="test" />
+         <file name="LoggedTest.php" role="test" />
+         <file name="StoredTest.php" role="test" />
+        </dir> <!-- /test/Horde/Kolab/Session/Class/Decorator -->
+        <dir name="Factory">
          <file name="BaseTest.php" role="test" />
          <file name="ConfigurationTest.php" role="test" />
          <file name="ConstructorTest.php" role="test" />
+         <dir name="Decorator">
+          <file name="AnonymousTest.php" role="test" />
+          <file name="LoggedTest.php" role="test" />
+         </dir> <!-- /test/Horde/Kolab/Session/Class/Factory/Decorator -->
          <file name="DefaultTest.php" role="test" />
          <file name="InjectorTest.php" role="test" />
-         <file name="LoggedTest.php" role="test" />
         </dir> <!-- /test/Horde/Kolab/Session/Class/Factory -->
-        <file name="LoggedTest.php" role="test" />
         <dir name="Storage">
          <file name="MockTest.php" role="test" />
          <file name="SessionobjectsTest.php" role="test" />
         </dir> <!-- /test/Horde/Kolab/Session/Class/Storage -->
-        <file name="StoredTest.php" role="test" />
         <dir name="Valid">
          <file name="BaseTest.php" role="test" />
-         <file name="LoggedTest.php" role="test" />
+         <dir name="Decorator">
+          <file name="LoggedTest.php" role="test" />
+         </dir> <!-- /test/Horde/Kolab/Session/Class/Valid/Decorator -->
         </dir> <!-- /test/Horde/Kolab/Session/Class/Valid -->
        </dir> <!-- /test/Horde/Kolab/Session/Class -->
        <dir name="Integration">
@@ -170,50 +182,50 @@ http://pear.php.net/dtd/package-2.0.xsd">
  </dependencies>
  <phprelease>
   <filelist>
-   <install name="lib/Horde/Kolab/Session.php" as="Horde/Kolab/Session.php" />
-   <install name="lib/Horde/Kolab/Session/Anonymous.php" as="Horde/Kolab/Session/Anonymous.php" />
-   <install name="lib/Horde/Kolab/Session/Auth.php" as="Horde/Kolab/Session/Auth.php" />
    <install name="lib/Horde/Kolab/Session/Auth/Horde.php" as="Horde/Kolab/Session/Auth/Horde.php" />
+   <install name="lib/Horde/Kolab/Session/Auth/Interface.php" as="Horde/Kolab/Session/Auth/Interface.php" />
    <install name="lib/Horde/Kolab/Session/Auth/Mock.php" as="Horde/Kolab/Session/Auth/Mock.php" />
    <install name="lib/Horde/Kolab/Session/Base.php" as="Horde/Kolab/Session/Base.php" />
    <install name="lib/Horde/Kolab/Session/Exception.php" as="Horde/Kolab/Session/Exception.php" />
    <install name="lib/Horde/Kolab/Session/Exception/Badlogin.php" as="Horde/Kolab/Session/Exception/Badlogin.php" />
-   <install name="lib/Horde/Kolab/Session/Factory.php" as="Horde/Kolab/Session/Factory.php" />
-   <install name="lib/Horde/Kolab/Session/Factory/Anonymous.php" as="Horde/Kolab/Session/Factory/Anonymous.php" />
+   <install name="lib/Horde/Kolab/Session/Decorator/Anonymous.php" as="Horde/Kolab/Session/Decorator/Anonymous.php" />
+   <install name="lib/Horde/Kolab/Session/Decorator/Logged.php" as="Horde/Kolab/Session/Decorator/Logged.php" />
+   <install name="lib/Horde/Kolab/Session/Decorator/Stored.php" as="Horde/Kolab/Session/Decorator/Stored.php" />
    <install name="lib/Horde/Kolab/Session/Factory/Base.php" as="Horde/Kolab/Session/Factory/Base.php" />
    <install name="lib/Horde/Kolab/Session/Factory/Configuration.php" as="Horde/Kolab/Session/Factory/Configuration.php" />
    <install name="lib/Horde/Kolab/Session/Factory/Constructor.php" as="Horde/Kolab/Session/Factory/Constructor.php" />
    <install name="lib/Horde/Kolab/Session/Factory/Default.php" as="Horde/Kolab/Session/Factory/Default.php" />
+   <install name="lib/Horde/Kolab/Session/Factory/Decorator/Anonymous.php" as="Horde/Kolab/Session/Factory/Decorator/Anonymous.php" />
+   <install name="lib/Horde/Kolab/Session/Factory/Decorator/Logged.php" as="Horde/Kolab/Session/Factory/Decorator/Logged.php" />
    <install name="lib/Horde/Kolab/Session/Factory/Injector.php" as="Horde/Kolab/Session/Factory/Injector.php" />
-   <install name="lib/Horde/Kolab/Session/Factory/Logged.php" as="Horde/Kolab/Session/Factory/Logged.php" />
-   <install name="lib/Horde/Kolab/Session/Logged.php" as="Horde/Kolab/Session/Logged.php" />
+   <install name="lib/Horde/Kolab/Session/Factory/Interface.php" as="Horde/Kolab/Session/Factory/Interface.php" />
+   <install name="lib/Horde/Kolab/Session/Interface.php" as="Horde/Kolab/Session/Interface.php" />
    <install name="lib/Horde/Kolab/Session/Singleton.php" as="Horde/Kolab/Session/Singleton.php" />
-   <install name="lib/Horde/Kolab/Session/Storage.php" as="Horde/Kolab/Session/Storage.php" />
+   <install name="lib/Horde/Kolab/Session/Storage/Interface.php" as="Horde/Kolab/Session/Storage/Interface.php" />
    <install name="lib/Horde/Kolab/Session/Storage/Mock.php" as="Horde/Kolab/Session/Storage/Mock.php" />
    <install name="lib/Horde/Kolab/Session/Storage/Sessionobjects.php" as="Horde/Kolab/Session/Storage/Sessionobjects.php" />
-   <install name="lib/Horde/Kolab/Session/Stored.php" as="Horde/Kolab/Session/Stored.php" />
-   <install name="lib/Horde/Kolab/Session/Valid.php" as="Horde/Kolab/Session/Valid.php" />
    <install name="lib/Horde/Kolab/Session/Valid/Base.php" as="Horde/Kolab/Session/Valid/Base.php" />
-   <install name="lib/Horde/Kolab/Session/Valid/Logged.php" as="Horde/Kolab/Session/Valid/Logged.php" />
+   <install name="lib/Horde/Kolab/Session/Valid/Decorator/Logged.php" as="Horde/Kolab/Session/Valid/Decorator/Logged.php" />
+   <install name="lib/Horde/Kolab/Session/Valid/Interface.php" as="Horde/Kolab/Session/Valid/Interface.php" />
    <install name="test/Horde/Kolab/Session/AllTests.php" as="Horde/Kolab/Session/AllTests.php" />
    <install name="test/Horde/Kolab/Session/Autoload.php" as="Horde/Kolab/Session/Autoload.php" />
-   <install name="test/Horde/Kolab/Session/Class/AnonymousTest.php" as="Horde/Kolab/Session/Class/AnonymousTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Auth/HordeTest.php" as="Horde/Kolab/Session/Class/Auth/HordeTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Auth/MockTest.php" as="Horde/Kolab/Session/Class/Auth/MockTest.php" />
    <install name="test/Horde/Kolab/Session/Class/BaseTest.php" as="Horde/Kolab/Session/Class/BaseTest.php" />
-   <install name="test/Horde/Kolab/Session/Class/Factory/AnonymousTest.php" as="Horde/Kolab/Session/Class/Factory/AnonymousTest.php" />
+   <install name="test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php" as="Horde/Kolab/Session/Class/Decorator/AnonymousTest.php" />
+   <install name="test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php" as="Horde/Kolab/Session/Class/Decorator/LoggedTest.php" />
+   <install name="test/Horde/Kolab/Session/Class/Decorator/StoredTest.php" as="Horde/Kolab/Session/Class/Decorator/StoredTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Factory/BaseTest.php" as="Horde/Kolab/Session/Class/Factory/BaseTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Factory/ConfigurationTest.php" as="Horde/Kolab/Session/Class/Factory/ConfigurationTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Factory/ConstructorTest.php" as="Horde/Kolab/Session/Class/Factory/ConstructorTest.php" />
+   <install name="test/Horde/Kolab/Session/Class/Factory/Decorator/AnonymousTest.php" as="Horde/Kolab/Session/Class/Factory/Decorator/AnonymousTest.php" />
+   <install name="test/Horde/Kolab/Session/Class/Factory/Decorator/LoggedTest.php" as="Horde/Kolab/Session/Class/Factory/Decorator/LoggedTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Factory/DefaultTest.php" as="Horde/Kolab/Session/Class/Factory/DefaultTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Factory/InjectorTest.php" as="Horde/Kolab/Session/Class/Factory/InjectorTest.php" />
-   <install name="test/Horde/Kolab/Session/Class/Factory/LoggedTest.php" as="Horde/Kolab/Session/Class/Factory/LoggedTest.php" />
-   <install name="test/Horde/Kolab/Session/Class/LoggedTest.php" as="Horde/Kolab/Session/Class/LoggedTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Storage/MockTest.php" as="Horde/Kolab/Session/Class/Storage/MockTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php" as="Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php" />
-   <install name="test/Horde/Kolab/Session/Class/StoredTest.php" as="Horde/Kolab/Session/Class/StoredTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Valid/BaseTest.php" as="Horde/Kolab/Session/Class/Valid/BaseTest.php" />
-   <install name="test/Horde/Kolab/Session/Class/Valid/LoggedTest.php" as="Horde/Kolab/Session/Class/Valid/LoggedTest.php" />
+   <install name="test/Horde/Kolab/Session/Class/Valid/Decorator/LoggedTest.php" as="Horde/Kolab/Session/Class/Valid/Decorator/LoggedTest.php" />
    <install name="test/Horde/Kolab/Session/Integration/AnonymousTest.php" as="Horde/Kolab/Session/Integration/AnonymousTest.php" />
    <install name="test/Horde/Kolab/Session/Integration/SessionTest.php" as="Horde/Kolab/Session/Integration/SessionTest.php" />
    <install name="test/Horde/Kolab/Session/Integration/SingletonTest.php" as="Horde/Kolab/Session/Integration/SingletonTest.php" />
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/AnonymousTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/AnonymousTest.php
deleted file mode 100644 (file)
index 05b0f2b..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-/**
- * Test the anonymous decorator.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../Autoload.php';
-
-/**
- * Test the anonymous decorator.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    public function testMethodConnectHasPostconditionThatTheConnectionHasBeenEstablishedAsAnonymousUserIfRequired()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getId')
-            ->will($this->returnValue(null));
-        $session->expects($this->once())
-            ->method('setId')
-            ->with('anonymous');
-        $session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'pass'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->connect();
-    }
-
-    public function testMethodGetidReturnsNullIfConnectedUserIsAnonymousUser()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getId')
-            ->will($this->returnValue('anonymous'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $this->assertNull($anonymous->getId());
-    }
-
-    public function testMethodConnectGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'pass'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->connect(array('password' => 'pass'));
-    }
-
-    public function testMethodGetidGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getId')
-            ->will($this->returnValue('1'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->getId();
-    }
-
-    public function testMethodSetidGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('setId')
-            ->with('1');
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->setId('1');
-    }
-
-    public function testMethodGetmailGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getMail')
-            ->will($this->returnValue('1'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->getMail();
-    }
-
-    public function testMethodGetuidGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getUid')
-            ->will($this->returnValue('1'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->getUid();
-    }
-
-    public function testMethodGetnameGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getName')
-            ->will($this->returnValue('1'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->getName();
-    }
-
-    public function testMethodGetimapserverGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getImapServer')
-            ->will($this->returnValue('1'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->getImapServer();
-    }
-
-    public function testMethodGetfreebusyserverGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getFreebusyServer')
-            ->will($this->returnValue('1'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->getFreebusyServer();
-    }
-
-    public function testMethodGetstorageGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getStorage')
-            ->will($this->returnValue('1'));
-        $anonymous = new Horde_Kolab_Session_Anonymous(
-            $session, 'anonymous', 'pass'
-        );
-        $anonymous->getStorage();
-    }
-
-
-}
\ No newline at end of file
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php
new file mode 100644 (file)
index 0000000..d98e4c6
--- /dev/null
@@ -0,0 +1,175 @@
+<?php
+/**
+ * Test the anonymous decorator.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../Autoload.php';
+
+/**
+ * Test the anonymous decorator.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+class Horde_Kolab_Session_Class_Decorator_AnonymousTest
+extends Horde_Kolab_Session_SessionTestCase
+{
+    public function testMethodConnectHasPostconditionThatTheConnectionHasBeenEstablishedAsAnonymousUserIfRequired()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getId')
+            ->will($this->returnValue(null));
+        $session->expects($this->once())
+            ->method('setId')
+            ->with('anonymous');
+        $session->expects($this->once())
+            ->method('connect')
+            ->with(array('password' => 'pass'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->connect();
+    }
+
+    public function testMethodGetidReturnsNullIfConnectedUserIsAnonymousUser()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getId')
+            ->will($this->returnValue('anonymous'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $this->assertNull($anonymous->getId());
+    }
+
+    public function testMethodConnectGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('connect')
+            ->with(array('password' => 'pass'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->connect(array('password' => 'pass'));
+    }
+
+    public function testMethodGetidGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getId')
+            ->will($this->returnValue('1'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->getId();
+    }
+
+    public function testMethodSetidGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('setId')
+            ->with('1');
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->setId('1');
+    }
+
+    public function testMethodGetmailGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getMail')
+            ->will($this->returnValue('1'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->getMail();
+    }
+
+    public function testMethodGetuidGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getUid')
+            ->will($this->returnValue('1'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->getUid();
+    }
+
+    public function testMethodGetnameGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getName')
+            ->will($this->returnValue('1'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->getName();
+    }
+
+    public function testMethodGetimapserverGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getImapServer')
+            ->will($this->returnValue('1'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->getImapServer();
+    }
+
+    public function testMethodGetfreebusyserverGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getFreebusyServer')
+            ->will($this->returnValue('1'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->getFreebusyServer();
+    }
+
+    public function testMethodGetstorageGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getStorage')
+            ->will($this->returnValue('1'));
+        $anonymous = new Horde_Kolab_Session_Decorator_Anonymous(
+            $session, 'anonymous', 'pass'
+        );
+        $anonymous->getStorage();
+    }
+
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php
new file mode 100644 (file)
index 0000000..80bf6c5
--- /dev/null
@@ -0,0 +1,184 @@
+<?php
+/**
+ * Test the log decorator.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../Autoload.php';
+
+/**
+ * Test the log decorator.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+class Horde_Kolab_Session_Class_Decorator_LoggedTest
+extends Horde_Kolab_Session_SessionTestCase
+{
+    public function setUp()
+    {
+        parent::setUp();
+
+        $this->setupLogger();
+    }
+
+    public function testMethodConnectHasPostconditionThatASuccessfulConnectionGetsLogged()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('connect')
+            ->with(array('password' => 'pass'));
+        $session->expects($this->once())
+            ->method('getId')
+            ->will($this->returnValue('somebody@example.org'));
+        $this->logger->expects($this->once())
+            ->method('__call')
+            ->with(
+                'info',
+                array(
+                    'Connected Kolab session for "somebody@example.org".'
+                )
+            );
+        $logged = new Horde_Kolab_Session_Decorator_Logged(
+            $session, $this->logger
+        );
+        $logged->connect(array('password' => 'pass'));
+    }
+
+    public function testMethodConnectHasPostconditionThatAnUnsuccessfulConnectionGetsLogged()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('connect')
+            ->will($this->throwException(new Horde_Kolab_Session_Exception('Error.')));
+        $session->expects($this->once())
+            ->method('getId')
+            ->will($this->returnValue('somebody@example.org'));
+        $this->logger->expects($this->once())
+            ->method('__call')
+            ->with(
+                'err',
+                array(
+                    'Failed to connect Kolab session for "somebody@example.org". Error was: Error.'
+                )
+            );
+        $logged = new Horde_Kolab_Session_Decorator_Logged(
+            $session, $this->logger
+        );
+        try {
+            $logged->connect(array('password' => 'pass'));
+            $this->fail('No Exception!');
+        } catch (Horde_Kolab_Session_Exception $e) {
+        }
+    }
+
+    public function testMethodConnectGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('connect')
+            ->with(array('password' => 'pass'));
+        $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger);
+        $logged->connect(array('password' => 'pass'));
+    }
+
+    public function testMethodGetidGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getId')
+            ->will($this->returnValue('1'));
+        $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger);
+        $logged->getId();
+    }
+
+    public function testMethodSetidGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('setId')
+            ->with('1');
+        $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger);
+        $logged->setId('1');
+    }
+
+    public function testMethodGetmailGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getMail')
+            ->will($this->returnValue('1'));
+        $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger);
+        $logged->getMail();
+    }
+
+    public function testMethodGetuidGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getUid')
+            ->will($this->returnValue('1'));
+        $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger);
+        $logged->getUid();
+    }
+
+    public function testMethodGetnameGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getName')
+            ->will($this->returnValue('1'));
+        $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger);
+        $logged->getName();
+    }
+
+    public function testMethodGetimapserverGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getImapServer')
+            ->will($this->returnValue('1'));
+        $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger);
+        $logged->getImapServer();
+    }
+
+    public function testMethodGetfreebusyserverGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getFreebusyServer')
+            ->will($this->returnValue('1'));
+        $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger);
+        $logged->getFreebusyServer();
+    }
+
+    public function testMethodGetstorageGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getStorage')
+            ->will($this->returnValue('1'));
+        $logged = new Horde_Kolab_Session_Decorator_Logged($session, $this->logger);
+        $logged->getStorage();
+    }
+
+
+}
\ No newline at end of file
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php
new file mode 100644 (file)
index 0000000..f181463
--- /dev/null
@@ -0,0 +1,144 @@
+<?php
+/**
+ * Test the storing decorator.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../Autoload.php';
+
+/**
+ * Test the storing decorator.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+class Horde_Kolab_Session_Class_Decorator_StoredTest
+extends Horde_Kolab_Session_SessionTestCase
+{
+    public function setUp()
+    {
+        parent::setUp();
+
+        $this->setupStorage();
+    }
+
+    public function testMethodDestructHasPostconditionThatTheSessionWasSaved()
+    {
+        $this->storage->expects($this->once())
+            ->method('save')
+            ->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_Interface');
+        $session->expects($this->once())
+            ->method('connect')
+            ->with(array('password' => 'pass'));
+        $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
+        $stored->connect(array('password' => 'pass'));
+    }
+
+    public function testMethodGetidGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getId')
+            ->will($this->returnValue('1'));
+        $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
+        $stored->getId();
+    }
+
+    public function testMethodSetidGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('setId')
+            ->with('1');
+        $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
+        $stored->setId('1');
+    }
+
+    public function testMethodGetmailGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getMail')
+            ->will($this->returnValue('1'));
+        $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
+        $stored->getMail();
+    }
+
+    public function testMethodGetuidGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getUid')
+            ->will($this->returnValue('1'));
+        $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
+        $stored->getUid();
+    }
+
+    public function testMethodGetnameGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getName')
+            ->will($this->returnValue('1'));
+        $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
+        $stored->getName();
+    }
+
+    public function testMethodGetimapserverGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getImapServer')
+            ->will($this->returnValue('1'));
+        $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
+        $stored->getImapServer();
+    }
+
+    public function testMethodGetfreebusyserverGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getFreebusyServer')
+            ->will($this->returnValue('1'));
+        $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
+        $stored->getFreebusyServer();
+    }
+
+    public function testMethodGetstorageGetsDelegated()
+    {
+        $session = $this->getMock('Horde_Kolab_Session_Interface');
+        $session->expects($this->once())
+            ->method('getStorage')
+            ->will($this->returnValue('1'));
+        $stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
+        $stored->getStorage();
+    }
+
+
+}
\ 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/AnonymousTest.php
deleted file mode 100644 (file)
index 6209ea7..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-<?php
-/**
- * Test the anonymous decorator factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../Autoload.php';
-
-/**
- * Test the anonymous decorator factory.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    public function testMethodCreatesessionHasResultHordekolabsessionanonymous()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('createSession')
-            ->will($this->returnValue($session));
-        $factory = new Horde_Kolab_Session_Factory_Anonymous(
-            $factory, 'anonymous', ''
-        );
-        $this->assertType(
-            'Horde_Kolab_Session_Anonymous',
-            $factory->createSession()
-        );
-    }
-
-    public function testMethodGetserverGetsDelegated()
-    {
-        $server = $this->getMock('Horde_Kolab_Server');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getServer')
-            ->will($this->returnValue($server));
-        $factory = new Horde_Kolab_Session_Factory_Anonymous(
-            $factory, 'anonymous', ''
-        );
-        $this->assertType('Horde_Kolab_Server', $factory->getServer());
-    }
-
-    public function testMethodGetsessionauthGetsDelegated()
-    {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getSessionAuth')
-            ->will($this->returnValue($auth));
-        $factory = new Horde_Kolab_Session_Factory_Anonymous(
-            $factory, 'anonymous', ''
-        );
-        $this->assertType(
-            'Horde_Kolab_Session_Auth',
-            $factory->getSessionAuth()
-        );
-    }
-
-    public function testMethodGetsessionconfigurationGetsDelegated()
-    {
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getSessionConfiguration')
-            ->will($this->returnValue(array()));
-        $factory = new Horde_Kolab_Session_Factory_Anonymous(
-            $factory, 'anonymous', ''
-        );
-        $this->assertType('array', $factory->getSessionConfiguration());
-    }
-
-    public function testMethodGetsessionstorageGetsDelegated()
-    {
-        $storage = $this->getMock('Horde_Kolab_Session_Storage');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getSessionStorage')
-            ->will($this->returnValue($storage));
-        $factory = new Horde_Kolab_Session_Factory_Anonymous(
-            $factory, 'anonymous', ''
-        );
-        $this->assertType(
-            'Horde_Kolab_Session_Storage',
-            $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');
-        $factory->expects($this->once())
-            ->method('getSessionValidator')
-            ->will($this->returnValue($validator));
-        $factory = new Horde_Kolab_Session_Factory_Anonymous(
-            $factory, 'anonymous', ''
-        );
-        $this->assertType(
-            'Horde_Kolab_Session_Valid',
-            $factory->getSessionValidator($session, $auth)
-        );
-    }
-
-    public function testMethodValidateGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('validate')
-            ->will($this->returnValue(true));
-        $factory = new Horde_Kolab_Session_Factory_Anonymous(
-            $factory, 'anonymous', ''
-        );
-        $this->assertTrue($factory->validate($session, 'test'));
-    }
-
-    public function testMethodCreatesessionGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('createSession')
-            ->will($this->returnValue($session));
-        $factory = new Horde_Kolab_Session_Factory_Anonymous(
-            $factory, 'anonymous', ''
-        );
-        $this->assertType('Horde_Kolab_Session', $factory->createSession());
-    }
-
-    public function testMethodGetsessionGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getSession')
-            ->will($this->returnValue($session));
-        $factory = new Horde_Kolab_Session_Factory_Anonymous(
-            $factory, 'anonymous', ''
-        );
-        $this->assertType('Horde_Kolab_Session', $factory->getSession());
-    }
-}
\ No newline at end of file
index 0ff43c5..2284c16 100644 (file)
@@ -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
index 5946485..f47b619 100644 (file)
@@ -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
index d80a035..6a23d9d 100644 (file)
@@ -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/Decorator/AnonymousTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/AnonymousTest.php
new file mode 100644 (file)
index 0000000..50abdeb
--- /dev/null
@@ -0,0 +1,165 @@
+<?php
+/**
+ * Test the anonymous decorator factory.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the anonymous decorator factory.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @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_Decorator_AnonymousTest
+extends Horde_Kolab_Session_SessionTestCase
+{
+    public function testMethodCreatesessionHasResultHordekolabsessionanonymous()
+    {
+        $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_Decorator_Anonymous(
+            $factory, 'anonymous', ''
+        );
+        $this->assertType(
+            'Horde_Kolab_Session_Decorator_Anonymous',
+            $factory->createSession()
+        );
+    }
+
+    public function testMethodGetserverGetsDelegated()
+    {
+        $server = $this->getMock('Horde_Kolab_Server');
+        $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface');
+        $factory->expects($this->once())
+            ->method('getServer')
+            ->will($this->returnValue($server));
+        $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous(
+            $factory, 'anonymous', ''
+        );
+        $this->assertType('Horde_Kolab_Server', $factory->getServer());
+    }
+
+    public function testMethodGetsessionauthGetsDelegated()
+    {
+        $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_Decorator_Anonymous(
+            $factory, 'anonymous', ''
+        );
+        $this->assertType(
+            'Horde_Kolab_Session_Auth_Interface',
+            $factory->getSessionAuth()
+        );
+    }
+
+    public function testMethodGetsessionconfigurationGetsDelegated()
+    {
+        $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface');
+        $factory->expects($this->once())
+            ->method('getSessionConfiguration')
+            ->will($this->returnValue(array()));
+        $factory = new Horde_Kolab_Session_Factory_Decorator_Anonymous(
+            $factory, 'anonymous', ''
+        );
+        $this->assertType('array', $factory->getSessionConfiguration());
+    }
+
+    public function testMethodGetsessionstorageGetsDelegated()
+    {
+        $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_Decorator_Anonymous(
+            $factory, 'anonymous', ''
+        );
+        $this->assertType(
+            'Horde_Kolab_Session_Storage_Interface',
+            $factory->getSessionStorage()
+        );
+    }
+
+    public function testMethodGetsessionvalidatorGetsDelegated()
+    {
+        $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_Decorator_Anonymous(
+            $factory, 'anonymous', ''
+        );
+        $this->assertType(
+            'Horde_Kolab_Session_Valid_Interface',
+            $factory->getSessionValidator($session, $auth)
+        );
+    }
+
+    public function testMethodValidateGetsDelegated()
+    {
+        $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_Decorator_Anonymous(
+            $factory, 'anonymous', ''
+        );
+        $this->assertTrue($factory->validate($session, 'test'));
+    }
+
+    public function testMethodCreatesessionGetsDelegated()
+    {
+        $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_Decorator_Anonymous(
+            $factory, 'anonymous', ''
+        );
+        $this->assertType('Horde_Kolab_Session_Interface', $factory->createSession());
+    }
+
+    public function testMethodGetsessionGetsDelegated()
+    {
+        $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_Decorator_Anonymous(
+            $factory, 'anonymous', ''
+        );
+        $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/Decorator/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/Decorator/LoggedTest.php
new file mode 100644 (file)
index 0000000..32b2cb1
--- /dev/null
@@ -0,0 +1,189 @@
+<?php
+/**
+ * Test the log decorator factory.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the log decorator factory.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @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_Decorator_LoggedTest
+extends Horde_Kolab_Session_SessionTestCase
+{
+    public function setUp()
+    {
+        parent::setUp();
+        $this->setupLogger();
+    }
+
+    public function testMethodCreatesessionHasResultHordekolabsessionlogged()
+    {
+        $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_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertType(
+            'Horde_Kolab_Session_Decorator_Logged',
+            $factory->createSession()
+        );
+    }
+
+    public function testMethodGetsessionvalidatorHasResultHordekolabsessionvalidlogged()
+    {
+        $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_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertType(
+            'Horde_Kolab_Session_Valid_Decorator_Logged',
+            $factory->getSessionValidator($session, $auth)
+        );
+    }
+
+    public function testMethodGetserverGetsDelegated()
+    {
+        $server = $this->getMock('Horde_Kolab_Server');
+        $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface');
+        $factory->expects($this->once())
+            ->method('getServer')
+            ->will($this->returnValue($server));
+        $factory = new Horde_Kolab_Session_Factory_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertType('Horde_Kolab_Server', $factory->getServer());
+    }
+
+    public function testMethodGetsessionauthGetsDelegated()
+    {
+        $auth = $this->getMock('Horde_Kolab_Session_Auth');
+        $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface');
+        $factory->expects($this->once())
+            ->method('getSessionAuth')
+            ->will($this->returnValue($auth));
+        $factory = new Horde_Kolab_Session_Factory_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertType(
+            'Horde_Kolab_Session_Auth',
+            $factory->getSessionAuth()
+        );
+    }
+
+    public function testMethodGetsessionconfigurationGetsDelegated()
+    {
+        $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface');
+        $factory->expects($this->once())
+            ->method('getSessionConfiguration')
+            ->will($this->returnValue(array()));
+        $factory = new Horde_Kolab_Session_Factory_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertType('array', $factory->getSessionConfiguration());
+    }
+
+    public function testMethodGetsessionstorageGetsDelegated()
+    {
+        $storage = $this->getMock('Horde_Kolab_Session_Storage');
+        $factory = $this->getMock('Horde_Kolab_Session_Factory_Interface');
+        $factory->expects($this->once())
+            ->method('getSessionStorage')
+            ->will($this->returnValue($storage));
+        $factory = new Horde_Kolab_Session_Factory_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertType(
+            'Horde_Kolab_Session_Storage',
+            $factory->getSessionStorage()
+        );
+    }
+
+    public function testMethodGetsessionvalidatorGetsDelegated()
+    {
+        $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_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertType(
+            'Horde_Kolab_Session_Valid_Interface',
+            $factory->getSessionValidator($session, $auth)
+        );
+    }
+
+    public function testMethodValidateGetsDelegated()
+    {
+        $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_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertTrue($factory->validate($session, 'test'));
+    }
+
+    public function testMethodCreatesessionGetsDelegated()
+    {
+        $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_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertType('Horde_Kolab_Session_Interface', $factory->createSession());
+    }
+
+    public function testMethodGetsessionGetsDelegated()
+    {
+        $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_Decorator_Logged(
+            $factory, $this->logger
+        );
+        $this->assertType('Horde_Kolab_Session_Interface', $factory->getSession());
+    }
+}
\ No newline at end of file
index c22d892..14587b3 100644 (file)
@@ -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
index 24dab3f..d455efc 100644 (file)
@@ -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/Factory/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Factory/LoggedTest.php
deleted file mode 100644 (file)
index 367b134..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-<?php
-/**
- * Test the log decorator factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../Autoload.php';
-
-/**
- * Test the log decorator factory.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    public function setUp()
-    {
-        parent::setUp();
-        $this->setupLogger();
-    }
-
-    public function testMethodCreatesessionHasResultHordekolabsessionlogged()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('createSession')
-            ->will($this->returnValue($session));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertType(
-            'Horde_Kolab_Session_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');
-        $factory->expects($this->once())
-            ->method('getSessionValidator')
-            ->will($this->returnValue($validator));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertType(
-            'Horde_Kolab_Session_Valid_Logged',
-            $factory->getSessionValidator($session, $auth)
-        );
-    }
-
-    public function testMethodGetserverGetsDelegated()
-    {
-        $server = $this->getMock('Horde_Kolab_Server');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getServer')
-            ->will($this->returnValue($server));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertType('Horde_Kolab_Server', $factory->getServer());
-    }
-
-    public function testMethodGetsessionauthGetsDelegated()
-    {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getSessionAuth')
-            ->will($this->returnValue($auth));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertType(
-            'Horde_Kolab_Session_Auth',
-            $factory->getSessionAuth()
-        );
-    }
-
-    public function testMethodGetsessionconfigurationGetsDelegated()
-    {
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getSessionConfiguration')
-            ->will($this->returnValue(array()));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertType('array', $factory->getSessionConfiguration());
-    }
-
-    public function testMethodGetsessionstorageGetsDelegated()
-    {
-        $storage = $this->getMock('Horde_Kolab_Session_Storage');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getSessionStorage')
-            ->will($this->returnValue($storage));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertType(
-            'Horde_Kolab_Session_Storage',
-            $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');
-        $factory->expects($this->once())
-            ->method('getSessionValidator')
-            ->will($this->returnValue($validator));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertType(
-            'Horde_Kolab_Session_Valid',
-            $factory->getSessionValidator($session, $auth)
-        );
-    }
-
-    public function testMethodValidateGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('validate')
-            ->will($this->returnValue(true));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertTrue($factory->validate($session, 'test'));
-    }
-
-    public function testMethodCreatesessionGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('createSession')
-            ->will($this->returnValue($session));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertType('Horde_Kolab_Session', $factory->createSession());
-    }
-
-    public function testMethodGetsessionGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $factory = $this->getMock('Horde_Kolab_Session_Factory');
-        $factory->expects($this->once())
-            ->method('getSession')
-            ->will($this->returnValue($session));
-        $factory = new Horde_Kolab_Session_Factory_Logged(
-            $factory, $this->logger
-        );
-        $this->assertType('Horde_Kolab_Session', $factory->getSession());
-    }
-}
\ No newline at end of file
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/LoggedTest.php
deleted file mode 100644 (file)
index f8be545..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-/**
- * Test the log decorator.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../Autoload.php';
-
-/**
- * Test the log decorator.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    public function setUp()
-    {
-        parent::setUp();
-
-        $this->setupLogger();
-    }
-
-    public function testMethodConnectHasPostconditionThatASuccessfulConnectionGetsLogged()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'pass'));
-        $session->expects($this->once())
-            ->method('getId')
-            ->will($this->returnValue('somebody@example.org'));
-        $this->logger->expects($this->once())
-            ->method('__call')
-            ->with(
-                'info',
-                array('Connected Kolab session for "somebody@example.org".')
-            );
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->connect(array('password' => 'pass'));
-    }
-
-    public function testMethodConnectHasPostconditionThatAnUnsuccessfulConnectionGetsLogged()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('connect')
-            ->will($this->throwException(new Horde_Kolab_Session_Exception('Error.')));
-        $session->expects($this->once())
-            ->method('getId')
-            ->will($this->returnValue('somebody@example.org'));
-        $this->logger->expects($this->once())
-            ->method('__call')
-            ->with(
-                'err',
-                array('Failed to connect Kolab session for "somebody@example.org". Error was: Error.')
-            );
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        try {
-            $logged->connect(array('password' => 'pass'));
-            $this->fail('No Exception!');
-        } catch (Horde_Kolab_Session_Exception $e) {
-        }
-    }
-
-    public function testMethodConnectGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'pass'));
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->connect(array('password' => 'pass'));
-    }
-
-    public function testMethodGetidGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getId')
-            ->will($this->returnValue('1'));
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->getId();
-    }
-
-    public function testMethodSetidGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('setId')
-            ->with('1');
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->setId('1');
-    }
-
-    public function testMethodGetmailGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getMail')
-            ->will($this->returnValue('1'));
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->getMail();
-    }
-
-    public function testMethodGetuidGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getUid')
-            ->will($this->returnValue('1'));
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->getUid();
-    }
-
-    public function testMethodGetnameGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getName')
-            ->will($this->returnValue('1'));
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->getName();
-    }
-
-    public function testMethodGetimapserverGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getImapServer')
-            ->will($this->returnValue('1'));
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->getImapServer();
-    }
-
-    public function testMethodGetfreebusyserverGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getFreebusyServer')
-            ->will($this->returnValue('1'));
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->getFreebusyServer();
-    }
-
-    public function testMethodGetstorageGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getStorage')
-            ->will($this->returnValue('1'));
-        $logged = new Horde_Kolab_Session_Logged($session, $this->logger);
-        $logged->getStorage();
-    }
-
-
-}
\ No newline at end of file
index b187259..d08a864 100644 (file)
@@ -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);
index ec620a6..06be6be 100644 (file)
@@ -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/StoredTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/StoredTest.php
deleted file mode 100644 (file)
index 767da7b..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-/**
- * Test the storing decorator.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../Autoload.php';
-
-/**
- * Test the storing decorator.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    public function setUp()
-    {
-        parent::setUp();
-
-        $this->setupStorage();
-    }
-
-    public function testMethodDestructHasPostconditionThatTheSessionWasSaved()
-    {
-        $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);
-        $stored = null;
-    }
-
-    public function testMethodConnectGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'pass'));
-        $stored = new Horde_Kolab_Session_Stored($session, $this->storage);
-        $stored->connect(array('password' => 'pass'));
-    }
-
-    public function testMethodGetidGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getId')
-            ->will($this->returnValue('1'));
-        $stored = new Horde_Kolab_Session_Stored($session, $this->storage);
-        $stored->getId();
-    }
-
-    public function testMethodSetidGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('setId')
-            ->with('1');
-        $stored = new Horde_Kolab_Session_Stored($session, $this->storage);
-        $stored->setId('1');
-    }
-
-    public function testMethodGetmailGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getMail')
-            ->will($this->returnValue('1'));
-        $stored = new Horde_Kolab_Session_Stored($session, $this->storage);
-        $stored->getMail();
-    }
-
-    public function testMethodGetuidGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getUid')
-            ->will($this->returnValue('1'));
-        $stored = new Horde_Kolab_Session_Stored($session, $this->storage);
-        $stored->getUid();
-    }
-
-    public function testMethodGetnameGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getName')
-            ->will($this->returnValue('1'));
-        $stored = new Horde_Kolab_Session_Stored($session, $this->storage);
-        $stored->getName();
-    }
-
-    public function testMethodGetimapserverGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getImapServer')
-            ->will($this->returnValue('1'));
-        $stored = new Horde_Kolab_Session_Stored($session, $this->storage);
-        $stored->getImapServer();
-    }
-
-    public function testMethodGetfreebusyserverGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getFreebusyServer')
-            ->will($this->returnValue('1'));
-        $stored = new Horde_Kolab_Session_Stored($session, $this->storage);
-        $stored->getFreebusyServer();
-    }
-
-    public function testMethodGetstorageGetsDelegated()
-    {
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->once())
-            ->method('getStorage')
-            ->will($this->returnValue('1'));
-        $stored = new Horde_Kolab_Session_Stored($session, $this->storage);
-        $stored->getStorage();
-    }
-
-
-}
\ No newline at end of file
index 7f9b700..42a976d 100644 (file)
@@ -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/Decorator/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/Decorator/LoggedTest.php
new file mode 100644 (file)
index 0000000..04a59f4
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+/**
+ * Test the log decorator for validators.
+ *
+ * PHP version 5
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Kolab_Session
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the log decorator for validators.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Kolab
+ * @package  Kolab_Session
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @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_Decorator_LoggedTest
+extends Horde_Kolab_Session_SessionTestCase
+{
+    public function setUp()
+    {
+        parent::setUp();
+
+        $this->setupLogger();
+    }
+
+    public function testMethodIsvalidHasPostconditionThatAnInvalidSessionGetsLogged()
+    {
+        $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_Interface');
+        $session->expects($this->exactly(2))
+            ->method('getMail')
+            ->will($this->returnValue('somebody@example.org'));
+        $this->logger->expects($this->once())
+            ->method('__call')
+            ->with(
+                '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_Decorator_Logged(
+            $session, $this->logger
+        );
+        $valid = new Horde_Kolab_Session_Valid_Base($session, $auth);
+        $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_Interface');
+        $valid->expects($this->once())
+            ->method('isValid')
+            ->will($this->returnValue(true));
+        $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_Interface');
+        $valid->expects($this->once())
+            ->method('getSession');
+        $logged = new Horde_Kolab_Session_Valid_Decorator_Logged($valid, $this->logger);
+        $logged->getSession();
+    }
+
+    public function testMethodGetauthGetsDelegated()
+    {
+        $valid = $this->getMock('Horde_Kolab_Session_Valid_Interface');
+        $valid->expects($this->once())
+            ->method('getAuth');
+        $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/Class/Valid/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/LoggedTest.php
deleted file mode 100644 (file)
index bd51d04..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/**
- * Test the log decorator for validators.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../Autoload.php';
-
-/**
- * Test the log decorator for validators.
- *
- * Copyright 2009 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @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
-{
-    public function setUp()
-    {
-        parent::setUp();
-
-        $this->setupLogger();
-    }
-
-    public function testMethodIsvalidHasPostconditionThatAnInvalidSessionGetsLogged()
-    {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth');
-        $auth->expects($this->exactly(2))
-            ->method('getCurrentUser')
-            ->will($this->returnValue('auth@example.org'));
-        $session = $this->getMock('Horde_Kolab_Session');
-        $session->expects($this->exactly(2))
-            ->method('getMail')
-            ->will($this->returnValue('somebody@example.org'));
-        $this->logger->expects($this->once())
-            ->method('__call')
-            ->with(
-                '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);
-        $valid = new Horde_Kolab_Session_Valid_Base($session, $auth);
-        $logged = new Horde_Kolab_Session_Valid_Logged($valid, $this->logger);
-        $this->assertFalse($logged->isValid('nobody@example.org'));
-    }
-
-    public function testMethodIsvalidGetsDelegated()
-    {
-        $valid = $this->getMock('Horde_Kolab_Session_Valid');
-        $valid->expects($this->once())
-            ->method('isValid')
-            ->will($this->returnValue(true));
-        $logged = new Horde_Kolab_Session_Valid_Logged($valid, $this->logger);
-        $this->assertTrue($logged->isValid());
-    }
-
-    public function testMethodGetsessionGetsDelegated()
-    {
-        $valid = $this->getMock('Horde_Kolab_Session_Valid');
-        $valid->expects($this->once())
-            ->method('getSession');
-        $logged = new Horde_Kolab_Session_Valid_Logged($valid, $this->logger);
-        $logged->getSession();
-    }
-
-    public function testMethodGetauthGetsDelegated()
-    {
-        $valid = $this->getMock('Horde_Kolab_Session_Valid');
-        $valid->expects($this->once())
-            ->method('getAuth');
-        $logged = new Horde_Kolab_Session_Valid_Logged($valid, $this->logger);
-        $logged->getAuth();
-    }
-}
\ No newline at end of file
index 6791dc0..a09c466 100644 (file)
@@ -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();
index 6166e8c..3d80fd3 100644 (file)
@@ -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));
index ecd608d..af81445 100644 (file)
@@ -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')
             )
index 2a0785a..a4a6241 100644 (file)
@@ -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'));
index c74404f..a8dcee4 100644 (file)
@@ -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