protected function _authenticate($userId, $credentials)
{
try {
- $session = $this->getSession($userId, $credentials);
+ $session = $GLOBALS['injector']->getInstance('Horde_Kolab_Session');
+ $session->connect($userId, $credentials);
} catch (Horde_Kolab_Session_Exception_Badlogin $e) {
throw new Horde_Auth_Exception('', Horde_Auth::REASON_BADLOGIN);
} catch (Horde_Kolab_Session_Exception $e) {
--- /dev/null
+<?php
+/**
+ * A Horde_Injector:: based Kolab_Session:: factory.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Core
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+
+/**
+ * A Horde_Injector:: based Kolab_Session:: factory.
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package Core
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+class Horde_Core_Factory_KolabSession
+{
+ /**
+ * The injector.
+ *
+ * @var Horde_Injector
+ */
+ private $_injector;
+
+ /**
+ * Constructor.
+ *
+ * @param array $config Configuration parameters for the session.
+ * @param Horde_Injector $injector The injector to use.
+ */
+ public function __construct(
+ Horde_Injector $injector
+ ) {
+ $this->_injector = $injector;
+ $this->_setup();
+ }
+
+ /**
+ * Setup the machinery to create Horde_Kolab_Session objects.
+ *
+ * @return NULL
+ */
+ private function _setup()
+ {
+ $this->_setupConfiguration();
+ $this->_setupAuth();
+ $this->_setupStorage();
+ }
+
+ /**
+ * Provide configuration settings for Horde_Kolab_Session.
+ *
+ * @return NULL
+ */
+ private function _setupConfiguration()
+ {
+ $configuration = array();
+ if (!empty($GLOBALS['conf']['kolab']['session'])) {
+ $configuration = $GLOBALS['conf']['kolab']['session'];
+ }
+ $this->_injector->setInstance(
+ 'Horde_Kolab_Session_Configuration', $configuration
+ );
+ }
+
+ /**
+ * Setup the machinery to create a Horde_Kolab_Session_Auth handler.
+ *
+ * @return NULL
+ */
+ private function _setupAuth()
+ {
+ $this->_injector->bindImplementation(
+ 'Horde_Kolab_Session_Auth_Interface',
+ 'Horde_Kolab_Session_Auth_Horde'
+ );
+ }
+
+ /**
+ * Setup the machinery to create a Horde_Kolab_Session_Storage handlers.
+ *
+ * @return NULL
+ */
+ private function _setupStorage()
+ {
+ $this->_injector->bindFactory(
+ 'Horde_Kolab_Session_Storage_Interface',
+ 'Horde_Core_Factory_KolabSession',
+ 'getStorage'
+ );
+ }
+
+ /**
+ * Return the session storage driver.
+ *
+ * @return Horde_Kolab_Session_Storage The driver for storing sessions.
+ */
+ public function getStorage()
+ {
+ $storage = new Horde_Kolab_Session_Storage_Sessionobjects(
+ Horde_SessionObjects::singleton()
+ );
+ return $storage;
+ }
+
+ /**
+ * 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
+ ) {
+ $configuration = $this->_injector->getInstance('Horde_Kolab_Session_Configuration');
+
+ $validator = new Horde_Kolab_Session_Valid_Base(
+ $session, $auth
+ );
+
+ if (isset($configuration['debug']) || isset($configuration['log'])) {
+ $validator = new Horde_Kolab_Session_Valid_Decorator_Logged(
+ $validator, $this->_injector->getInstance('Horde_Log_Logger')
+ );
+ }
+
+ return $validator;
+ }
+
+ /**
+ * Validate the given session.
+ *
+ * @param Horde_Kolab_Session_Interface $session The session to validate.
+ *
+ * @return boolean True if the given session is valid.
+ */
+ public function validate(
+ Horde_Kolab_Session_Interface $session
+ ) {
+ return $this->getSessionValidator(
+ $session,
+ $this->_injector->getInstance('Horde_Kolab_Session_Auth_Interface')
+ )->isValid();
+ }
+
+ /**
+ * Returns a new session handler.
+ *
+ * @return Horde_Kolab_Session The concrete Kolab session reference.
+ */
+ public function createSession()
+ {
+ $session = new Horde_Kolab_Session_Base(
+ $this->_injector->getInstance('Horde_Kolab_Server_Composite'),
+ $this->_injector->getInstance('Horde_Kolab_Session_Configuration')
+ );
+
+ //@todo: Fix validation
+ /** If we created a new session handler it needs to be stored once */
+ $session = new Horde_Kolab_Session_Decorator_Stored(
+ $session,
+ $this->_injector->getInstance('Horde_Kolab_Session_Storage_Interface')
+ );
+ return $session;
+ }
+
+ /**
+ * Return the Horde_Kolab_Session:: instance.
+ *
+ * @return Horde_Kolab_Session The session handler.
+ */
+ public function getSession()
+ {
+ $storage = $this->_injector->getInstance('Horde_Kolab_Session_Storage_Interface');
+ $session = $storage->load();
+
+ if (empty($session) || !$this->validate($session)) {
+ $session = $this->createSession();
+ }
+
+ $configuration = $this->_injector->getInstance('Horde_Kolab_Session_Configuration');
+
+
+ if (isset($configuration['debug']) || isset($configuration['log'])) {
+ $session = new Horde_Kolab_Session_Decorator_Logged(
+ $session, $this->_injector->getInstance('Horde_Log_Logger')
+ );
+ }
+
+ if (isset($configuration['anonymous']['user'])
+ && isset($configuration['anonymous']['pass'])
+ ) {
+ $session = new Horde_Kolab_Session_Decorator_Anonymous(
+ $session,
+ $configuration['anonymous']['user'],
+ $configuration['anonymous']['pass']
+ );
+ }
+
+ return $session;
+ }
+}
$injector->addBinder('Horde_Template', new Horde_Core_Binder_Template());
$injector->addBinder('Net_DNS_Resolver', new Horde_Core_Binder_Dns());
$injector->bindFactory('Horde_Kolab_Server_Composite', 'Horde_Core_Factory_KolabServer', 'getComposite');
+ $injector->bindFactory('Horde_Kolab_Session', 'Horde_Core_Factory_KolabSession', 'getSession');
$GLOBALS['registry'] = $this;
$injector->setInstance('Horde_Registry', $this);
</dir> <!-- /lib/Horde/Core/Binder -->
<dir name="Factory">
<file name="KolabServer.php" role="php" />
+ <file name="KolabSession.php" role="php" />
</dir> <!-- /lib/Horde/Core/Factory -->
<dir name="Log">
<file name="Logger.php" role="php" />
<file name="Autoload.php" role="test" />
<dir name="Factory">
<file name="KolabServerTest.php" role="test" />
+ <file name="KolabSessionTest.php" role="test" />
</dir> <!-- /test/Horde/Core/Factory -->
<file name="phpunit.xml" role="test" />
<file name="url.phpt" role="test" />
<channel>pear.horde.org</channel>
</package>
<package>
+ <name>Kolab_Server</name>
+ <channel>pear.horde.org</channel>
+ </package>
+ <package>
+ <name>Kolab_Storage</name>
+ <channel>pear.horde.org</channel>
+ </package>
+ <package>
<name>Form</name>
<channel>pear.horde.org</channel>
</package>
<install name="lib/Horde/Core/Binder/Perms.php" as="Horde/Core/Binder/Perms.php" />
<install name="lib/Horde/Core/Binder/Template.php" as="Horde/Core/Binder/Template.php" />
<install name="lib/Horde/Core/Factory/KolabServer.php" as="Horde/Core/Factory/KolabServer.php" />
+ <install name="lib/Horde/Core/Factory/KolabSession.php" as="Horde/Core/Factory/KolabSession.php" />
<install name="lib/Horde/Core/Log/Logger.php" as="Horde/Core/Log/Logger.php" />
<install name="lib/Horde/Core/Notification/Hordelog.php" as="Horde/Core/Notification/Hordelog.php" />
<install name="lib/Horde/Core/Notification/Status.php" as="Horde/Core/Notification/Status.php" />
<install name="test/Horde/Core/AllTests.php" as="Horde/Core/AllTests.php" />
<install name="test/Horde/Core/Autoload.php" as="Horde/Core/Autoload.php" />
<install name="test/Horde/Core/Factory/KolabServerTest.php" as="Horde/Core/Factory/KolabServerTest.php" />
+ <install name="test/Horde/Core/Factory/KolabSessionTest.php" as="Horde/Core/Factory/KolabSessionTest.php" />
</filelist>
</phprelease>
<changelog>
--- /dev/null
+<?php
+/**
+ * Test the Kolab_Session factory.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Core
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+
+/**
+ * Require our basic test case definition
+ */
+require_once dirname(__FILE__) . '/../Autoload.php';
+
+/**
+ * Test the Kolab_Session factory.
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package Core
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+class Horde_Core_Factory_KolabSessionTest extends PHPUnit_Framework_TestCase
+{
+ private function _getFactory()
+ {
+ $GLOBALS['conf']['kolab']['server']['basedn'] = 'test';
+ $injector = new Horde_Injector(new Horde_Injector_TopLevel());
+ $server_factory = new Horde_Core_Factory_KolabServer($injector);
+ $factory = new Horde_Core_Factory_KolabSession($injector);
+ $this->session_auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+ $this->session_storage = $this->getMock('Horde_Kolab_Session_Storage_Interface');
+ $injector->setInstance('Horde_Kolab_Session_Auth_Interface', $this->session_auth);
+ $injector->setInstance('Horde_Kolab_Session_Storage_Interface', $this->session_storage);
+ return $factory;
+ }
+
+ public function testMethodGetvalidatorHasResultHordekolabsessionvalid()
+ {
+ $session = $this->getMock('Horde_Kolab_Session_Interface');
+ $this->assertType(
+ 'Horde_Kolab_Session_Valid_Interface',
+ $this->_getFactory()->getSessionValidator($session, $this->session_auth)
+ );
+ }
+
+ public function testMethodValidateHasResultTrueIfTheSessionIsStillValid()
+ {
+ $factory = $this->_getFactory();
+ $this->session_auth->expects($this->once())
+ ->method('getCurrentUser')
+ ->will($this->returnValue('mail@example.org'));
+ $session = $this->getMock('Horde_Kolab_Session_Interface');
+ $session->expects($this->once())
+ ->method('getMail')
+ ->will($this->returnValue('mail@example.org'));
+ $this->assertTrue($factory->validate($session));
+ }
+
+ public function testMethodCreatesessionHasResultHordekolabsessionstored()
+ {
+ $this->assertType('Horde_Kolab_Session_Decorator_Stored', $this->_getFactory()->createSession());
+ }
+
+ public function testMethodGetsessionHasResultHordekolabsessionTheOldSessionIfAnOldSessionWasStoredAndValid()
+ {
+ $factory = $this->_getFactory();
+ $session = $this->getMock('Horde_Kolab_Session_Interface');
+ $session->expects($this->once())
+ ->method('getMail')
+ ->will($this->returnValue('mail@example.org'));
+ $this->session_storage->expects($this->once())
+ ->method('load')
+ ->will($this->returnValue($session));
+ $this->session_auth->expects($this->once())
+ ->method('getCurrentUser')
+ ->will($this->returnValue('mail@example.org'));
+ $this->assertSame($session, $factory->getSession());
+ }
+
+ public function testMethodGetsessionHasResultHordekolabsessionANewSessionIfAnOldSessionWasStoredAndInvalid()
+ {
+ $factory = $this->_getFactory();
+ $session = $this->getMock('Horde_Kolab_Session_Interface');
+ $session->expects($this->once())
+ ->method('getMail')
+ ->will($this->returnValue('mail@example.org'));
+ $this->session_storage->expects($this->once())
+ ->method('load')
+ ->will($this->returnValue($session));
+ $this->session_auth->expects($this->once())
+ ->method('getCurrentUser')
+ ->will($this->returnValue('new@example.org'));
+ $this->assertTrue($session !== $factory->getSession());
+ }
+
+ public function testMethodGetsessionHasResultHordekolabsessionANewSessionIfNoOldSessionExisted()
+ {
+ $factory = $this->_getFactory();
+ $this->session_storage->expects($this->once())
+ ->method('load')
+ ->will($this->returnValue(false));
+ $this->assertType('Horde_Kolab_Session_Interface', $factory->getSession());
+ }
+
+
+ public function testMethodCreatesessionHasResultHordekolabsessionanonymousIfConfiguredThatWay()
+ {
+ $GLOBALS['conf']['kolab']['session']['anonymous']['user'] = 'anonymous';
+ $GLOBALS['conf']['kolab']['session']['anonymous']['pass'] = '';
+ $this->assertType(
+ 'Horde_Kolab_Session_Decorator_Anonymous',
+ $this->_getFactory()->getSession()
+ );
+ }
+
+ public function testMethodCreatesessionHasResultHordekolabsessionloggedIfConfiguredThatWay()
+ {
+ $GLOBALS['conf']['kolab']['session']['log'] = true;
+ $this->assertType(
+ 'Horde_Kolab_Session_Decorator_Logged',
+ $this->_getFactory()->getSession()
+ );
+ }
+
+ public function testMethodGetsessionvalidatorHasResultHordekolabsessionvalidloggedIfConfiguredThatWay()
+ {
+ $session = $this->getMock('Horde_Kolab_Session_Interface');
+ $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+ $GLOBALS['conf']['kolab']['session']['log'] = true;
+ $this->assertType(
+ 'Horde_Kolab_Session_Valid_Decorator_Logged',
+ $this->_getFactory()->getSessionValidator($session, $auth)
+ );
+ }
+
+ public function testMethodGetstorageHasresultSessionstorage()
+ {
+ $this->assertType(
+ 'Horde_Kolab_Session_Storage_Interface',
+ $this->_getFactory()->getStorage()
+ );
+ }
+}
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Revives an old Horde_Kolab_Session handler or generates a new one if
- * required.
- *
- * 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
- */
-
-/**
- * Revives an old Horde_Kolab_Session handler or generates a new one if
- * required.
- *
- * Copyright 2008-2010 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
- */
-abstract class Horde_Kolab_Session_Factory_Base
-implements Horde_Kolab_Session_Factory_Interface
-{
- /**
- * 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
- ) {
- $validator = new Horde_Kolab_Session_Valid_Base(
- $session, $auth
- );
- return $validator;
- }
-
- /**
- * Validate the given session.
- *
- * @param Horde_Kolab_Session_Interface $session The session to validate.
- *
- * @return boolean True if the given session is valid.
- */
- public function validate(
- Horde_Kolab_Session_Interface $session
- ) {
- return $this->getSessionValidator(
- $session,
- $this->getSessionAuth()
- )->isValid();
- }
-
- /**
- * Returns a new session handler.
- *
- * @return Horde_Kolab_Session The concrete Kolab session reference.
- */
- public function createSession()
- {
- $session = new Horde_Kolab_Session_Base(
- $this->getServer(),
- $this->getSessionConfiguration()
- );
- /** If we created a new session handler it needs to be stored once */
- $session = new Horde_Kolab_Session_Decorator_Stored(
- $session,
- $this->getSessionStorage()
- );
- return $session;
- }
-
- /**
- * Returns either a reference to a session handler with data retrieved from
- * the session or a new session handler.
- *
- * @return Horde_Kolab_Session The concrete Kolab session reference.
- */
- public function getSession()
- {
- $storage = $this->getSessionStorage();
- $session = $storage->load();
-
- if (!empty($session) && $this->validate($session)) {
- return $session;
- }
- $session = $this->createSession();
- return $session;
- }
-}
+++ /dev/null
-<?php
-/**
- * A factory that receives all required details via configuration parameters.
- *
- * 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 that receives all required details via configuration parameters.
- *
- * Copyright 2009-2010 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_Configuration
-implements Horde_Kolab_Session_Factory_Interface
-{
- /**
- * Configuration parameters for the session.
- *
- * @var array
- */
- private $_configuration;
-
- /**
- * The factory used for creating the instances.
- *
- * @var Horde_Kolab_Session_Factory
- */
- private $_factory;
-
- /**
- * Constructor.
- *
- * @param array $config Configuration parameters for the session.
- */
- public function __construct(array $config)
- {
- $this->_configuration = $config;
-
- if (isset($config['server'])) {
- $server_configuration = $config['server'];
- } elseif (isset($config['ldap'])) {
- $server_configuration = $config['ldap'];
- } else {
- throw new Horde_Kolab_Session_Exception(
- 'The Kolab server configuration is missing!'
- );
- }
-
- $server_factory = new Horde_Kolab_Server_Factory_Configuration(
- $server_configuration
- );
-
- $factory = new Horde_Kolab_Session_Factory_Default(
- $config, $server_factory
- );
-
- if (isset($config['logger'])) {
- $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_Decorator_Anonymous(
- $factory,
- $config['session']['anonymous']['user'],
- $config['session']['anonymous']['pass']
- );
- }
-
- $this->_factory = $factory;
- }
-
- /**
- * 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_Interface $session,
- Horde_Kolab_Session_Auth_Interface $auth
- ) {
- return $this->_factory->getSessionValidator($session, $auth);
- }
-
- /**
- * Validate the given session.
- *
- * @return boolean True if the given session is valid.
- */
- public function validate(
- Horde_Kolab_Session_Interface $session
- ) {
- return $this->_factory->validate($session);
- }
-
- /**
- * Returns a new session handler.
- *
- * @return Horde_Kolab_Session The concrete Kolab session reference.
- */
- public function createSession()
- {
- return $this->_factory->createSession();
- }
-
- /**
- * Returns either a reference to a session handler with data retrieved from
- * the session or a new session handler.
- *
- * @return Horde_Kolab_Session The concrete Kolab session reference.
- */
- public function getSession()
- {
- return $this->_factory->getSession();
- }
-}
+++ /dev/null
-<?php
-/**
- * A factory that receives all required details via the factory constructor.
- *
- * 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 that receives all required details via the factory constructor.
- *
- * Copyright 2009-2010 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_Constructor
-extends Horde_Kolab_Session_Factory_Base
-{
- /**
- * The connection to the Kolab user db.
- *
- * @var Horde_Kolab_Server_Composite_Interface
- */
- private $_server;
-
- /**
- * The auth handler for the session.
- *
- * @var Horde_Kolab_Session_Auth_Interface
- */
- private $_auth;
-
- /**
- * Configuration parameters for the session.
- *
- * @var array
- */
- private $_configuration;
-
- /**
- * The storage handler for the session.
- *
- * @var Horde_Kolab_Session_Storage_Interface
- */
- private $_storage;
-
- /**
- * Constructor.
- *
- * @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 $server,
- Horde_Kolab_Session_Auth_Interface $auth,
- array $config,
- Horde_Kolab_Session_Storage_Interface $storage
- ) {
- $this->_server = $server;
- $this->_auth = $auth;
- $this->_configuration = $config;
- $this->_storage = $storage;
- }
-
- /**
- * Return the kolab user db connection.
- *
- * @return Horde_Kolab_Server The server connection.
- */
- public function getServer()
- {
- return $this->_server;
- }
-
- /**
- * Return the auth handler for sessions.
- *
- * @return Horde_Kolab_Session_Auth_Interface The authentication handler.
- */
- public function getSessionAuth()
- {
- return $this->_auth;
- }
-
- /**
- * Return the configuration parameters for the session.
- *
- * @return array The configuration values.
- */
- public function getSessionConfiguration()
- {
- return $this->_configuration;
- }
-
- /**
- * Return the session storage driver.
- *
- * @return Horde_Kolab_Session_Storage_Interface The driver for storing sessions.
- */
- public function getSessionStorage()
- {
- return $this->_storage;
- }
-}
+++ /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-2010 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.
- *
- * @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.
- *
- * @return boolean True if the given session is valid.
- */
- public function validate(
- Horde_Kolab_Session_Interface $session
- ) {
- return $this->_factory->validate($session);
- }
-
- /**
- * Returns a new session handler.
- *
- * @return Horde_Kolab_Session_Interface The concrete Kolab session reference.
- */
- public function createSession()
- {
- $session = $this->_factory->createSession();
- $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.
- *
- * @return Horde_Kolab_Session_Interface The concrete Kolab session reference.
- */
- public function getSession()
- {
- return $this->_factory->getSession();
- }
-}
+++ /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-2010 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.
- *
- * @return boolean True if the given session is valid.
- */
- public function validate(
- Horde_Kolab_Session_Interface $session
- ) {
- return $this->_factory->validate($session);
- }
-
- /**
- * Returns a new session handler.
- *
- * @return Horde_Kolab_Session_Interface The concrete Kolab session reference.
- */
- public function createSession()
- {
- $session = $this->_factory->createSession();
- $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()
- {
- return $this->_factory->getSession();
- }
-}
+++ /dev/null
-<?php
-/**
- * A factory implementing the default policy.
- *
- * 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 implementing the default policy.
- *
- * Copyright 2008-2010 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_Default
-extends Horde_Kolab_Session_Factory_Base
-{
- /**
- * Configuration parameters for the session.
- *
- * @var array
- */
- private $_configuration;
-
- /**
- * The server factory used by this instance.
- *
- * @var array
- */
- private $_server_factory;
-
- /**
- * Constructor.
- *
- * @param array $config Configuration parameters for
- * the session.
- * @param Horde_Kolab_Server_Factory $factory The factory for the Kolab user
- * db connection.
- */
- public function __construct(
- array $config,
- Horde_Kolab_Server_Factory_Interface $factory
- ) {
- $this->_configuration = $config;
- $this->_server_factory = $factory;
- }
-
- /**
- * Return the kolab user db connection.
- *
- * @return Horde_Kolab_Server The server connection.
- */
- public function getServer()
- {
- return $this->_server_factory->getComposite();
- }
-
- /**
- * Return the auth handler for sessions.
- *
- * @return Horde_Kolab_Session_Auth The authentication handler.
- */
- public function getSessionAuth()
- {
- $auth = new Horde_Kolab_Session_Auth_Horde();
- return $auth;
- }
-
- /**
- * Return the configuration parameters for the session.
- *
- * @return array The configuration values.
- */
- public function getSessionConfiguration()
- {
- return $this->_configuration;
- }
-
- /**
- * Return the session storage driver.
- *
- * @return Horde_Kolab_Session_Storage The driver for storing sessions.
- */
- public function getSessionStorage()
- {
- $storage = new Horde_Kolab_Session_Storage_Sessionobjects(
- Horde_SessionObjects::singleton()
- );
- return $storage;
- }
-}
+++ /dev/null
-<?php
-/**
- * A factory using a Horde_Injector instance.
- *
- * 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 using a Horde_Injector instance.
- *
- * Copyright 2009-2010 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_Injector
-extends Horde_Kolab_Session_Factory_Base
-{
- /**
- * Configuration parameters for the session.
- *
- * @var array
- */
- private $_configuration;
-
- /**
- * The injector.
- *
- * @var Horde_Injector
- */
- private $_injector;
-
- /**
- * Constructor.
- *
- * @param array $config Configuration parameters for the session.
- * @param Horde_Injector $injector The injector to use.
- */
- public function __construct(
- array $config,
- Horde_Injector $injector
- ) {
- $this->_configuration = $config;
- $this->_injector = $injector;
- $this->_setup();
- }
-
- /**
- * Setup the machinery to create Horde_Kolab_Session objects.
- *
- * @return NULL
- */
- private function _setup()
- {
- $this->_setupAuth();
- $this->_setupStorage();
- $this->_setupConfiguration();
- $this->_setupSession();
- }
-
- /**
- * Setup the machinery to create a Horde_Kolab_Session_Auth handler.
- *
- * @return NULL
- */
- private function _setupAuth()
- {
- $this->_injector->bindImplementation(
- 'Horde_Kolab_Session_Auth',
- 'Horde_Kolab_Session_Auth_Horde'
- );
- }
-
- /**
- * Setup the machinery to create a Horde_Kolab_Session_Storage handlers.
- *
- * @return NULL
- */
- private function _setupStorage()
- {
- $this->_injector->bindFactory(
- 'Horde_Kolab_Session_Storage',
- 'Horde_Kolab_Session_Factory_Injector',
- 'getStorage'
- );
- }
-
- /**
- * Provide configuration settings for Horde_Kolab_Session.
- *
- * @return NULL
- */
- private function _setupConfiguration()
- {
- $this->_injector->setInstance(
- 'Horde_Kolab_Session_Configuration', $this->_configuration
- );
- }
-
- /**
- * Setup the machinery to create a Horde_Kolab_Session handler.
- *
- * @return NULL
- */
- private function _setupSession()
- {
- $this->_injector->bindFactory(
- 'Horde_Kolab_Session',
- 'Horde_Kolab_Session_Factory_Injector',
- 'getSession'
- );
- }
-
- /**
- * A helper method to seed the injector with a Horde_Kolab_Server factory
- * definition. This should usually be done by an external setup method
- * before constructing the session injcetion factory.
- *
- * @param Horde_Injector $injector The injector to seed with the mock
- * configuration.
- *
- * @return NULL
- */
- static public function setupMockServerFactory(
- Horde_Injector $injector
- ) {
- Horde_Kolab_Server_Factory_Injector::setup(
- 'Horde_Kolab_Server_Factory_Connection_Mock',
- array('basedn' => ''),
- $injector
- );
- /** Setup the injector by constructing the server factory */
- $injector->getInstance('Horde_Kolab_Server_Factory_Injector');
- }
-
- /**
- * Return the kolab user db connection.
- *
- * @return Horde_Kolab_Server The server connection.
- */
- public function getServer()
- {
- return $this->_injector->getInstance(
- 'Horde_Kolab_Server_Composite_Interface'
- );
- }
-
- /**
- * Return the auth handler for sessions.
- *
- * @return Horde_Kolab_Session_Auth The authentication handler.
- */
- public function getSessionAuth()
- {
- return $this->_injector->getInstance('Horde_Kolab_Session_Auth');
- }
-
- /**
- * Return the configuration parameters for the session.
- *
- * @return array The configuration values.
- */
- public function getSessionConfiguration()
- {
- return $this->_injector->getInstance('Horde_Kolab_Session_Configuration');
- }
-
- /**
- * Return the session storage driver.
- *
- * @return Horde_Kolab_Session_Storage The driver for storing sessions.
- */
- public function getSessionStorage()
- {
- $storage = new Horde_Kolab_Session_Storage_Sessionobjects(
- Horde_SessionObjects::singleton()
- );
- return $storage;
- }
-}
+++ /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-2010 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.
- *
- * @param Horde_Kolab_Session_Interface $session The session to validate.
- *
- * @return boolean True if the given session is valid.
- */
- public function validate(
- Horde_Kolab_Session_Interface $session
- );
-
- /**
- * Returns a new session handler.
- *
- * @return Horde_Kolab_Session_Interface The concrete Kolab session reference.
- */
- public function createSession();
-
- /**
- * Returns either a reference to a session handler with data retrieved from
- * the session or a new session handler.
- *
- * @return Horde_Kolab_Session_Interface The concrete Kolab session reference.
- */
- public function getSession();
-}
<dir name="Exception">
<file name="Badlogin.php" role="php" />
</dir> <!-- /lib/Horde/Session/Exception -->
- <dir name="Factory">
- <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="Interface.php" role="php" />
- </dir> <!-- /lib/Horde/Session/Factory -->
<file name="Interface.php" role="php" />
<file name="Singleton.php" role="php" />
<dir name="Storage">
<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" />
- </dir> <!-- /test/Horde/Kolab/Session/Class/Factory -->
<dir name="Storage">
<file name="MockTest.php" role="test" />
<file name="SessionobjectsTest.php" role="test" />
<dir name="Integration">
<file name="AnonymousTest.php" role="test" />
<file name="SessionTest.php" role="test" />
- <file name="SingletonTest.php" role="test" />
<file name="ValidTest.php" role="test" />
</dir> <!-- /test/Horde/Kolab/Session/Integration -->
<file name="phpunit.xml" role="test" />
<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/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/Interface.php" as="Horde/Kolab/Session/Storage/Interface.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/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/Valid/BaseTest.php" as="Horde/Kolab/Session/Class/Valid/BaseTest.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" />
<install name="test/Horde/Kolab/Session/Integration/ValidTest.php" as="Horde/Kolab/Session/Integration/ValidTest.php" />
<install name="test/Horde/Kolab/Session/phpunit.xml" as="Horde/Kolab/Session/phpunit.php" />
<install name="test/Horde/Kolab/Session/SessionTestCase.php" as="Horde/Kolab/Session/SessionTestCase.php" />
+++ /dev/null
-<?php
-/**
- * Test the base factory definition via the constructor based 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 base factory definition via the constructor based factory.
- *
- * Copyright 2009-2010 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_BaseTest extends Horde_Kolab_Session_SessionTestCase
-{
- public function setUp()
- {
- parent::setUp();
- $this->setupFactoryMocks();
- $this->user = $this->getMock(
- 'Horde_Kolab_Server_Object_Hash', array(), array(), '', false, false
- );
- }
-
- public function testMethodGetvalidatorHasResultHordekolabsesessionvalid()
- {
- $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_Interface',
- $factory->getSessionValidator($session, $this->session_auth)
- );
- }
-
- public function testMethodValidateHasResultTrueIfTheSessionIsStillValid()
- {
- $this->session_auth->expects($this->once())
- ->method('getCurrentUser')
- ->will($this->returnValue('mail@example.org'));
- $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->assertTrue($factory->validate($session));
- }
-
- public function testMethodCreatesessionHasResultHordekolabsessionstored()
- {
- $factory = new Horde_Kolab_Session_Factory_Constructor(
- $this->server, $this->session_auth, array(), $this->session_storage
- );
- $this->assertType('Horde_Kolab_Session_Decorator_Stored', $factory->createSession());
- }
-
- public function testMethodGetsessionHasResultHordekolabsessionTheOldSessionIfAnOldSessionWasStoredAndValid()
- {
- $session = $this->getMock('Horde_Kolab_Session_Interface');
- $session->expects($this->once())
- ->method('getMail')
- ->will($this->returnValue('mail@example.org'));
- $this->session_storage->expects($this->once())
- ->method('load')
- ->will($this->returnValue($session));
- $this->session_auth->expects($this->once())
- ->method('getCurrentUser')
- ->will($this->returnValue('mail@example.org'));
- $factory = new Horde_Kolab_Session_Factory_Constructor(
- $this->server, $this->session_auth, array(), $this->session_storage
- );
- $this->assertSame($session, $factory->getSession());
- }
-
- public function testMethodGetsessionHasResultHordekolabsessionANewSessionIfAnOldSessionWasStoredAndInvalid()
- {
- $session = $this->getMock('Horde_Kolab_Session_Interface');
- $session->expects($this->once())
- ->method('getMail')
- ->will($this->returnValue('mail@example.org'));
- $this->session_storage->expects($this->once())
- ->method('load')
- ->will($this->returnValue($session));
- $this->session_auth->expects($this->once())
- ->method('getCurrentUser')
- ->will($this->returnValue('new@example.org'));
- $factory = new Horde_Kolab_Session_Factory_Constructor(
- $this->server, $this->session_auth, array(), $this->session_storage
- );
- $this->assertTrue($session !== $factory->getSession());
- }
-
- public function testMethodGetsessionHasResultHordekolabsessionANewSessionIfNoOldSessionExisted()
- {
- $this->session_storage->expects($this->once())
- ->method('load')
- ->will($this->returnValue(false));
- $factory = new Horde_Kolab_Session_Factory_Constructor(
- $this->server, $this->session_auth, array(), $this->session_storage
- );
- $this->assertType('Horde_Kolab_Session_Interface', $factory->getSession());
- }
-}
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Test the configuration based 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 configuration based factory.
- *
- * Copyright 2009-2010 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_ConfigurationTest extends Horde_Kolab_Session_SessionTestCase
-{
- public function setUp()
- {
- parent::setUp();
- $this->setupLogger();
- }
-
- public function testMethodConstructThrowsExceptionIfTheServerConfigurationIsMissing()
- {
- try {
- $factory = new Horde_Kolab_Session_Factory_Configuration(array());
- $this->fail('No exception!');
- } catch (Horde_Kolab_Session_Exception $e) {
- $this->assertEquals(
- 'The Kolab server configuration is missing!',
- $e->getMessage()
- );
- }
- }
-
- public function testMethodCreatesessionHasResultHordekolabsessionanonymousIfConfiguredThatWay()
- {
- $factory = new Horde_Kolab_Session_Factory_Configuration(
- array(
- 'session' => array(
- 'anonymous' => array(
- 'user' => 'anonymous',
- 'pass' => ''
- )
- ),
- 'server' => array(
- 'basedn' => ''
- )
- )
- );
- $this->assertType(
- 'Horde_Kolab_Session_Decorator_Anonymous',
- $factory->createSession()
- );
- }
-
- public function testMethodCreatesessionHasResultHordekolabsessionloggedIfConfiguredThatWay()
- {
- $factory = new Horde_Kolab_Session_Factory_Configuration(
- array(
- 'logger' => $this->logger,
- 'server' => array(
- 'basedn' => ''
- )
- )
- );
- $this->assertType(
- 'Horde_Kolab_Session_Decorator_Logged',
- $factory->createSession()
- );
- }
-
- public function testMethodGetsessionvalidatorHasResultHordekolabsessionvalidloggedIfConfiguredThatWay()
- {
- $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,
- 'server' => array(
- 'basedn' => ''
- )
- )
- );
- $this->assertType(
- 'Horde_Kolab_Session_Valid_Decorator_Logged',
- $factory->getSessionValidator($session, $auth)
- );
- }
-
- public function testMethodGetserverHasResultServercomposite()
- {
- $factory = new Horde_Kolab_Session_Factory_Configuration(
- array(
- 'server' => array(
- 'basedn' => ''
- )
- )
- );
- $this->assertType(
- 'Horde_Kolab_Server_Composite',
- $factory->getServer()
- );
- }
-
- public function testMethodGetsessionauthHasResultSessionauth()
- {
- $factory = new Horde_Kolab_Session_Factory_Configuration(
- array(
- 'server' => array(
- 'basedn' => ''
- )
- )
- );
- $this->assertType(
- 'Horde_Kolab_Session_Auth_Interface',
- $factory->getSessionAuth()
- );
- }
-
- public function testMethodGetsessionconfigurationHasResultArray()
- {
- $factory = new Horde_Kolab_Session_Factory_Configuration(
- array(
- 'server' => array(
- 'basedn' => ''
- )
- )
- );
- $this->assertType('array', $factory->getSessionConfiguration());
- }
-
- public function testMethodGetsessionstorageHasresultSessionstorage()
- {
- $factory = new Horde_Kolab_Session_Factory_Configuration(
- array(
- 'server' => array(
- 'basedn' => ''
- )
- )
- );
- $this->assertType(
- 'Horde_Kolab_Session_Storage_Interface',
- $factory->getSessionStorage()
- );
- }
-
- public function testMethodGetsessionvalidatorHasResultSessionvalid()
- {
- $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(
- 'basedn' => ''
- )
- )
- );
- $this->assertType(
- 'Horde_Kolab_Session_Valid_Interface',
- $factory->getSessionValidator($session, $auth)
- );
- }
-
- public function testMethodValidateHasResultBooleanTrueIfTheSessionIsStillValid()
- {
- $session = $this->getMock('Horde_Kolab_Session_Interface');
- $factory = new Horde_Kolab_Session_Factory_Configuration(
- array(
- 'server' => array(
- 'basedn' => ''
- )
- )
- );
- $this->assertTrue($factory->validate($session, ''));
- }
-
- public function testMethodCreatesessionHasResultSession()
- {
- $factory = new Horde_Kolab_Session_Factory_Configuration(
- array(
- 'server' => array(
- 'basedn' => ''
- )
- )
- );
- $this->assertType('Horde_Kolab_Session_Interface', $factory->createSession());
- }
-
- public function testMethodGetsessionHasResultSession()
- {
- $factory = new Horde_Kolab_Session_Factory_Configuration(
- array(
- 'server' => array(
- 'mock' => true,
- 'basedn' => '',
- 'data' => array(
- 'dn=user' => array(
- 'dn' => 'dn=user',
- 'data' => array(
- 'uid' => array(''),
- 'mail' => array('user@example.org'),
- 'userPassword' => array(''),
- 'objectClass' => array('top', 'kolabInetOrgPerson'),
- )
- )
- )
- )
- )
- );
- $this->assertType('Horde_Kolab_Session_Interface', $factory->getSession());
- }
-}
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Test the constructor based 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 constructor based factory.
- *
- * Copyright 2009-2010 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_ConstructorTest extends Horde_Kolab_Session_SessionTestCase
-{
- public function setUp()
- {
- parent::setUp();
- $this->setupFactoryMocks();
- }
-
- public function testMethodGetserverHasResultHordekolabserver()
- {
- $factory = new Horde_Kolab_Session_Factory_Constructor(
- $this->server, $this->session_auth, array(), $this->session_storage
- );
- $this->assertType('Horde_Kolab_Server_Composite', $factory->getServer());
- }
-
- public function testMethodGetsessionauthHasResultHordekolabsessionauth()
- {
- $factory = new Horde_Kolab_Session_Factory_Constructor(
- $this->server, $this->session_auth, array(), $this->session_storage
- );
- $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('array', $factory->getSessionConfiguration());
- }
-
- public function testMethodGetsessionstorageHasResultHordekolabsessionstorage()
- {
- $factory = new Horde_Kolab_Session_Factory_Constructor(
- $this->server, $this->session_auth, array(), $this->session_storage
- );
- $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-2010 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-2010 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
+++ /dev/null
-<?php
-/**
- * Test the default 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 default factory.
- *
- * Copyright 2009-2010 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_DefaultTest extends Horde_Kolab_Session_SessionTestCase
-{
- public function testMethodGetserverHasResultHordekolabserver()
- {
- $server = $this->getMock('Horde_Kolab_Server_Composite_Interface');
- $server_factory = $this->getMock('Horde_Kolab_Server_Factory_Interface');
- $server_factory->expects($this->once())
- ->method('getComposite')
- ->will($this->returnValue($server));
- $factory = new Horde_Kolab_Session_Factory_Default(
- array('server' => array()),
- $server_factory
- );
- $this->assertType(
- 'Horde_Kolab_Server_Composite_Interface', $factory->getServer()
- );
- }
-
- public function testMethodGetsessionauthHasResultHordekolabsessionauth()
- {
- $factory = new Horde_Kolab_Session_Factory_Default(
- array('server' => array()),
- $this->getMock('Horde_Kolab_Server_Factory_Interface')
- );
- $this->assertType('Horde_Kolab_Session_Auth_Interface', $factory->getSessionAuth());
- }
-
- public function testMethodGetsessionconfigurationHasResultArray()
- {
- $factory = new Horde_Kolab_Session_Factory_Default(
- array('server' => array()),
- $this->getMock('Horde_Kolab_Server_Factory_Interface')
- );
- $this->assertType('array', $factory->getSessionConfiguration());
- }
-
- public function testMethodGetsessionstorageHasResultHordekolabsessionstorage()
- {
- $factory = new Horde_Kolab_Session_Factory_Default(
- array('server' => array()),
- $this->getMock('Horde_Kolab_Server_Factory_Interface')
- );
- $this->assertType('Horde_Kolab_Session_Storage_Interface', $factory->getSessionStorage());
- }
-}
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Test the injector based 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 injector based factory.
- *
- * Copyright 2009-2010 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_InjectorTest extends Horde_Kolab_Session_SessionTestCase
-{
- public function setUp()
- {
- $this->injector = new Horde_Injector(new Horde_Injector_TopLevel());
- Horde_Kolab_Session_Factory_Injector::setupMockServerFactory($this->injector);
- }
-
- public function testMethodGetserverHasResultHordekolabserver()
- {
- $factory = new Horde_Kolab_Session_Factory_Injector(
- array('server' => array()), $this->injector
- );
- $this->assertType('Horde_Kolab_Server_Composite_Interface', $factory->getServer());
- }
-
- public function testMethodGetsessionauthHasResultHordekolabsessionauth()
- {
- $factory = new Horde_Kolab_Session_Factory_Injector(
- array('server' => array()), $this->injector
- );
- $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('array', $factory->getSessionConfiguration());
- }
-
- public function testMethodGetsessionstorageHasResultHordekolabsessionstorage()
- {
- $factory = new Horde_Kolab_Session_Factory_Injector(
- array('server' => array()), $this->injector
- );
- $this->assertType('Horde_Kolab_Session_Storage_Interface', $factory->getSessionStorage());
- }
-}
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Test the Kolab session singleton pattern.
- *
- * 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 Kolab session singleton pattern.
- *
- * Copyright 2009-2010 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_Integration_SingletonTest extends Horde_Kolab_Session_SessionTestCase
-{
- public function setUp()
- {
- global $conf;
-
- /** Provide a minimal configuration for the server */
- $conf['kolab']['ldap']['basedn'] = 'dc=test';
- $conf['kolab']['ldap']['mock'] = true;
- $conf['kolab']['ldap']['data'] = array(
- 'dn=user,dc=test' => array(
- 'dn' => 'dn=user,dc=test',
- 'data' => array(
- 'uid' => array('user'),
- 'mail' => array('user@example.org'),
- 'userPassword' => array('pass'),
- 'objectClass' => array('top', 'kolabInetOrgPerson'),
- )
- )
- );
- }
-
- public function testMethodSingletonHasResultHordekolabsession()
- {
- $this->assertType(
- 'Horde_Kolab_Session_Interface',
- Horde_Kolab_Session_Singleton::singleton(
- 'user', array('password' => 'pass')
- )
- );
- }
-
- public function testMethodSingletonHasResultHordekolabsessionAlwaysTheSameIfTheSessionIsValid()
- {
- $session1 = Horde_Kolab_Session_Singleton::singleton(
- 'user', array('password' => 'pass')
- );
- $session2 = Horde_Kolab_Session_Singleton::singleton(
- 'user', array('password' => 'pass')
- );
- $this->assertSame($session1, $session2);
- }
-}
\ No newline at end of file