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.
* @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();
}
*
* @var string
*/
- private $_imap_server;
+ private $_imap_server = false;
/**
* The free/busy server for the current user.
}
/**
- * Set the user id used for connecting the session.
- *
- * @param string $id The user id.
- *
- * @return NULL
- */
- public function setId($id)
- {
- $this->_user_id = $id;
- }
-
- /**
* Return the users mail address.
*
* @return string The users mail address.
{
return $this->_freebusy_server;
}
-
- /**
- * Return a connection to the Kolab storage system.
- *
- * @return Horde_Kolab_Storage The storage connection.
- *
- * @todo Implement
- */
- public function getStorage()
- {
- if (!$this->_connected) {
- return false;
- }
- if (empty($this->_storage)) {
- //@todo: factory?
- $this->_storage = new Horde_Kolab_Storage(
- 'Imap',
- //@todo: Use Session_Auth
- array('hostspec' => $this->getImapServer(),
- 'username' => Horde_Auth::getAuth(),
- 'password' => Horde_Auth::getCredential('password'),
- 'secure' => true)
- );
- }
- return $this->_storage;
- }
}
* @link http://pear.horde.org/index.php?package=Kolab_Session
*/
class Horde_Kolab_Session_Decorator_Anonymous
-implements Horde_Kolab_Session
+extends Horde_Kolab_Session_Decorator_Base
{
/**
- * The session handler this instance provides with anonymous access.
- *
- * @var Horde_Kolab_Session
- */
- private $_session;
-
- /**
* Anonymous user ID.
*
* @var string
$user,
$pass
) {
- $this->_session = $session;
+ parent::__construct($session);
$this->_anonymous_id = $user;
$this->_anonymous_pass = $pass;
}
}
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
+/**
+ * The Horde_Kolab_Session_Decorator_Base provides a base for session
+ * decorators.
+ *
+ * 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_Decorator_Base provides a base for session
+ * decorators.
+ *
+ * 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_Decorator_Base
+implements Horde_Kolab_Session
+{
+ /**
+ * The session handler this instance provides with anonymous access.
+ *
+ * @var Horde_Kolab_Session
+ */
+ protected $_session;
+
+ /**
+ * Constructor.
+ *
+ * @param Horde_Kolab_Session $session The this instance should provide
+ * anonymous access for.
+ */
+ public function __construct(
+ Horde_Kolab_Session $session
+ ) {
+ $this->_session = $session;
+ }
+
+ /**
+ * Try to connect the session handler.
+ *
+ * @param string $user_id The user ID to connect with.
+ * @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($user_id = null, array $credentials = null)
+ {
+ $this->_session->connect($user_id, $credentials);
+ }
+
+ /**
+ * Return the user id used for connecting the session.
+ *
+ * @return string The user id.
+ */
+ public function getId()
+ {
+ return $this->_session->getId();
+ }
+
+ /**
+ * 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();
+ }
+}
* @link http://pear.horde.org/index.php?package=Kolab_Session
*/
class Horde_Kolab_Session_Decorator_Logged
-implements Horde_Kolab_Session
+extends Horde_Kolab_Session_Decorator_Base
{
/**
- * The session handler.
- *
- * @var Horde_Kolab_Session
- */
- private $_session;
-
- /**
* The logger.
*
* @var mixed
Horde_Kolab_Session $session,
$logger
) {
- $this->_session = $session;
+ parent::__construct($session);
$this->_logger = $logger;
}
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();
- }
}
* @link http://pear.horde.org/index.php?package=Kolab_Session
*/
class Horde_Kolab_Session_Decorator_Stored
-implements Horde_Kolab_Session
+extends Horde_Kolab_Session_Decorator_Base
{
/**
- * The session handler.
- *
- * @var Horde_Kolab_Session
- */
- private $_session;
-
- /**
* The storage.
*
* @var Horde_Kolab_Session_Storage
Horde_Kolab_Session $session,
Horde_Kolab_Session_Storage_Interface $storage
) {
- $this->_session = $session;
+ parent::__construct($session);
$this->_storage = $storage;
}
$this->_session->connect($user_id, $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
-/**
- * A singleton pattern providing Horde_Kolab_Session 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 singleton pattern providing Horde_Kolab_Session instances.
- *
- * 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_Singleton
-{
- /**
- * Horde_Kolab_Session instance.
- *
- * @var Horde_Kolab_Session
- */
- static private $_instance;
-
- /**
- * Attempts to return a reference to a concrete Horde_Kolab_Session instance.
- *
- * It will only create a new instance if no Horde_Kolab_Session instance
- * currently exists
- *
- * @param string $user The session will be setup for the user with
- * this ID. For Kolab this must either contain
- * the user id or the primary user mail address.
- *
- * @param array $credentials An array of login credentials. For Kolab,
- * this must contain a "password" entry.
- *
- * @return Horde_Kolab_Session The concrete Session reference.
- *
- * @throws Horde_Kolab_Session_Exception If the connection failed.
- */
- static public function singleton($user = null, array $credentials = null)
- {
- global $conf;
-
- if (!isset(self::$_instance)) {
- $config = $conf['kolab'];
- $config['logger'] = Horde::getLogger();
- $factory = new Horde_Kolab_Session_Factory_Configuration($config);
- self::$_instance = $factory->getSession($user, $credentials);
- }
- return self::$_instance;
- }
-}
<file name="Base.php" role="php" />
<dir name="Decorator">
<file name="Anonymous.php" role="php" />
+ <file name="Base.php" role="php" />
<file name="Logged.php" role="php" />
<file name="Stored.php" role="php" />
</dir> <!-- /lib/Horde/Session/Decorator -->
<dir name="Exception">
<file name="Badlogin.php" role="php" />
</dir> <!-- /lib/Horde/Session/Exception -->
- <file name="Singleton.php" role="php" />
<dir name="Storage">
<file name="Mock.php" role="php" />
<file name="Interface.php" role="php" />
</dir> <!-- /test/Horde/Kolab/Session/Class -->
<dir name="Integration">
<file name="AnonymousTest.php" role="test" />
- <file name="SessionTest.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/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/Decorator/Anonymous.php" as="Horde/Kolab/Session/Decorator/Anonymous.php" />
+ <install name="lib/Horde/Kolab/Session/Decorator/Base.php" as="Horde/Kolab/Session/Decorator/Base.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/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="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="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/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" />
$session->connect('userid', array('password' => ''));
$this->assertEquals('localhost', $session->getImapServer());
}
-
- public function testMethodGetstorageHasResultKolabstorageConnectionForTheCurrentUser()
- {
- $this->markTestIncomplete('Not implemented');
- }
}
\ No newline at end of file
);
$anonymous->getId();
}
-
- public function testMethodSetidGetsDelegated()
- {
- $session = $this->getMock('Horde_Kolab_Session');
- $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');
- $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');
- $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');
- $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');
- $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');
- $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');
- $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 base 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 base decorator.
+ *
+ * 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_Decorator_BaseTest
+extends Horde_Kolab_Session_SessionTestCase
+{
+ public function testMethodConnectGetsDelegated()
+ {
+ $session = $this->getMock('Horde_Kolab_Session');
+ $session->expects($this->once())
+ ->method('connect')
+ ->with(array('password' => 'pass'));
+ $anonymous = new Horde_Kolab_Session_Decorator_Base(
+ $session
+ );
+ $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_Decorator_Base(
+ $session
+ );
+ $anonymous->getId();
+ }
+
+ public function testMethodGetmailGetsDelegated()
+ {
+ $session = $this->getMock('Horde_Kolab_Session');
+ $session->expects($this->once())
+ ->method('getMail')
+ ->will($this->returnValue('1'));
+ $anonymous = new Horde_Kolab_Session_Decorator_Base(
+ $session
+ );
+ $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_Decorator_Base(
+ $session
+ );
+ $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_Decorator_Base(
+ $session
+ );
+ $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_Decorator_Base(
+ $session
+ );
+ $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_Decorator_Base(
+ $session
+ );
+ $anonymous->getFreebusyServer();
+ }
+}
\ No newline at end of file
} 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_Decorator_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_Decorator_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_Decorator_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_Decorator_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_Decorator_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_Decorator_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_Decorator_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_Decorator_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_Decorator_Logged($session, $this->logger);
- $logged->getStorage();
- }
-
-
}
\ No newline at end of file
$stored = new Horde_Kolab_Session_Decorator_Stored($session, $this->storage);
$stored->connect(array('password' => 'pass'));
}
-
- public function testMethodGetidGetsDelegated()
- {
- $session = $this->getMock('Horde_Kolab_Session');
- $session->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');
- $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');
- $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');
- $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');
- $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');
- $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');
- $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');
- $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 Kolab session handler.
- *
- * 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 handler.
- *
- * 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_Integration_SessionTest
-extends Horde_Kolab_Session_SessionTestCase
-{
- /**
- * Test class construction.
- *
- * @return NULL
- */
- public function testConstructEmpty()
- {
- global $conf;
- $conf['kolab']['imap']['allow_special_users'] = true;
-
- $session = Horde_Kolab_Session::singleton();
-
- $this->assertEquals('anonymous', $session->user_mail);
-
- $params = $session->getImapParams();
- $this->assertNoError($params);
- $this->assertEquals('localhost', $params['hostspec']);
- $this->assertEquals(143, $params['port']);
- }
-
- /**
- * Test old style class construction.
- *
- * @return NULL
- */
- public function testConstructSimple()
- {
- global $conf;
- $conf['kolab']['imap']['server'] = 'example.com';
- $conf['kolab']['imap']['port'] = 200;
- $conf['kolab']['freebusy']['server'] = 'fb.example.com';
-
- $session = new Horde_Kolab_Session();
- $params = $session->getImapParams();
- $this->assertEquals('example.com', $params['hostspec']);
- $this->assertEquals(200, $params['port']);
- }
-
- /**
- * Test IMAP server retrieval.
- *
- * @return NULL
- */
- public function testGetSession()
- {
- $this->markTestSkipped();
- $server = &$this->prepareEmptyKolabServer();
- $result = $server->add($this->provideBasicUserTwo());
- $this->assertNoError($result);
- $this->assertEquals(1, count($GLOBALS['KOLAB_SERVER_TEST_DATA']));
-
- $session = Horde_Kolab_Session::singleton(
- 'test',
- array('password' => 'test')
- );
-
- $this->assertNoError($session->auth);
- $this->assertEquals('test@example.org', $session->user_mail);
-
- $params = $session->getImapParams();
- $this->assertNoError($params);
- $this->assertEquals('home.example.org', $params['hostspec']);
- $this->assertEquals(143, $params['port']);
- $this->assertEquals('test@example.org', $session->user_mail);
-
- $session->shutdown();
-
- $hs = Horde_SessionObjects::singleton();
-
- $recovered_session = &$hs->query('kolab_session');
- $params = $recovered_session->getImapParams();
- $this->assertNoError($params);
- $this->assertEquals('home.example.org', $params['hostspec']);
- $this->assertEquals(143, $params['port']);
- $this->assertEquals('test@example.org', $session->user_mail);
-
- $this->assertEquals(
- 'https://fb.example.org/freebusy', $session->freebusy_server
- );
- }
-
- /**
- * Test retrieving the FreeBusy server for the unauthenticated state.
- *
- * @return NULL
- */
- public function testGetFreeBusySession()
- {
- $this->markTestSkipped();
- $server = $this->prepareEmptyKolabServer();
- $result = $server->add($this->provideBasicUserTwo());
- $this->assertNoError($result);
- $session = Horde_Kolab_Session::singleton();
- $this->assertEquals('', $session->freebusy_server);
- }
-
-
-}