+++ /dev/null
-<?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();
-}
+++ /dev/null
-<?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();
- }
-}
+++ /dev/null
-<?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();
-}
* @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.
--- /dev/null
+<?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();
+}
* @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.
* @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.
--- /dev/null
+<?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();
+ }
+}
--- /dev/null
+<?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();
+ }
+}
--- /dev/null
+<?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();
+ }
+}
+++ /dev/null
-<?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);
-}
+++ /dev/null
-<?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);
- }
-}
* @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
*
* @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()
$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()
);
* @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.
);
if (isset($config['logger'])) {
- $factory = new Horde_Kolab_Session_Factory_Logged(
+ $factory = new Horde_Kolab_Session_Factory_Decorator_Logged(
$factory, $config['logger']
);
}
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']
* @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);
}
*
* @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);
}
/**
* 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;
/**
* 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;
/**
* 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()
{
/**
* 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()
{
--- /dev/null
+<?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);
+ }
+}
--- /dev/null
+<?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);
+ }
+}
--- /dev/null
+<?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);
+}
+++ /dev/null
-<?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);
- }
-}
--- /dev/null
+<?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();
+}
+++ /dev/null
-<?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();
- }
-}
+++ /dev/null
-<?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);
-}
--- /dev/null
+<?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);
+}
* @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.
/**
* 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;
}
* @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.
/**
* 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);
}
+++ /dev/null
-<?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();
- }
-}
+++ /dev/null
-<?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
* @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;
/**
* Return the session this validator checks.
*
- * @return Horde_Kolab_Session The session checked by this validator.
+ * @return Horde_Kolab_Session_Interface The session checked by this
+ * validator.
*/
public function getSession()
{
/**
* Return the auth driver of this validator.
*
- * @return Horde_Kolab_Session_Auth The auth driver set for this validator.
+ * @return Horde_Kolab_Session_Auth_Interface The auth driver set for this
+ * validator.
*/
public function getAuth()
{
--- /dev/null
+<?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();
+ }
+}
--- /dev/null
+<?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
+++ /dev/null
-<?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();
- }
-}
<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 -->
<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">
</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" />
+++ /dev/null
-<?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
--- /dev/null
+<?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
--- /dev/null
+<?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
--- /dev/null
+<?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
+++ /dev/null
-<?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
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)
);
}
$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'));
$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'));
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'));
$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
)
);
$this->assertType(
- 'Horde_Kolab_Session_Anonymous',
+ 'Horde_Kolab_Session_Decorator_Anonymous',
$factory->createSession()
);
}
)
);
$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,
)
);
$this->assertType(
- 'Horde_Kolab_Session_Valid_Logged',
+ 'Horde_Kolab_Session_Valid_Decorator_Logged',
$factory->getSessionValidator($session, $auth)
);
}
)
);
$this->assertType(
- 'Horde_Kolab_Session_Auth',
+ 'Horde_Kolab_Session_Auth_Interface',
$factory->getSessionAuth()
);
}
)
);
$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(
)
);
$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(
)
)
);
- $this->assertType('Horde_Kolab_Session', $factory->createSession());
+ $this->assertType('Horde_Kolab_Session_Interface', $factory->createSession());
}
public function testMethodGetsessionHasResultSession()
)
)
);
- $this->assertType('Horde_Kolab_Session', $factory->getSession());
+ $this->assertType('Horde_Kolab_Session_Interface', $factory->getSession());
}
}
\ No newline at end of file
$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()
$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
--- /dev/null
+<?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
--- /dev/null
+<?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
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()
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
$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()
$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
+++ /dev/null
-<?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
+++ /dev/null
-<?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
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);
$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);
}
+++ /dev/null
-<?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
{
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(''));
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(''));
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'));
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'));
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'));
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'));
--- /dev/null
+<?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
+++ /dev/null
-<?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
$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();
* @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.
$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);
$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
+ );
}
/**
$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));
$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));
public function testMethodSingletonHasResultHordekolabsession()
{
$this->assertType(
- 'Horde_Kolab_Session',
+ 'Horde_Kolab_Session_Interface',
Horde_Kolab_Session_Singleton::singleton(
'user', array('password' => 'pass')
)
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(''));
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'));
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'));
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'));
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'));
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'));
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