From: Gunnar Wrobel
Date: Wed, 17 Mar 2010 09:55:36 +0000 (+0100)
Subject: Remove getStorage(), getId() from the Kolab_Session interface, consolidate decorators...
X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8d6d2f02319f3355302210b630a695169c41b259;p=horde.git
Remove getStorage(), getId() from the Kolab_Session interface, consolidate decorators, adapt testing.
---
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session.php b/framework/Kolab_Session/lib/Horde/Kolab/Session.php
index 9485f7d4b..4a1e778f4 100644
--- a/framework/Kolab_Session/lib/Horde/Kolab/Session.php
+++ b/framework/Kolab_Session/lib/Horde/Kolab/Session.php
@@ -58,15 +58,6 @@ interface Horde_Kolab_Session
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.
@@ -100,11 +91,4 @@ interface Horde_Kolab_Session
* @return string The freebusy host for the current user.
*/
public function getFreebusyServer();
-
- /**
- * Return a connection to the Kolab storage system.
- *
- * @return Horde_Kolab_Storage The storage connection.
- */
- public function getStorage();
}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php
index ca5e0fcdc..5d1b5ff93 100644
--- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php
+++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php
@@ -73,7 +73,7 @@ class Horde_Kolab_Session_Base implements Horde_Kolab_Session
*
* @var string
*/
- private $_imap_server;
+ private $_imap_server = false;
/**
* The free/busy server for the current user.
@@ -291,18 +291,6 @@ class Horde_Kolab_Session_Base implements Horde_Kolab_Session
}
/**
- * 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.
@@ -351,30 +339,4 @@ class Horde_Kolab_Session_Base implements Horde_Kolab_Session
{
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;
- }
}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php
index 06c5d36c9..a6e39bf54 100644
--- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php
+++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php
@@ -34,16 +34,9 @@
* @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
@@ -70,7 +63,7 @@ implements Horde_Kolab_Session
$user,
$pass
) {
- $this->_session = $session;
+ parent::__construct($session);
$this->_anonymous_id = $user;
$this->_anonymous_pass = $pass;
}
@@ -108,78 +101,4 @@ implements Horde_Kolab_Session
}
return $id;
}
-
- /**
- * Set the user id used for connecting the session.
- *
- * @param string $id The user id.
- *
- * @return NULL
- */
- public function setId($id)
- {
- $this->_session->setId($id);
- }
-
- /**
- * Return the users mail address.
- *
- * @return string The users mail address.
- */
- public function getMail()
- {
- return $this->_session->getMail();
- }
-
- /**
- * Return the users uid.
- *
- * @return string The users uid.
- */
- public function getUid()
- {
- return $this->_session->getUid();
- }
-
- /**
- * Return the users name.
- *
- * @return string The users name.
- */
- public function getName()
- {
- return $this->_session->getName();
- }
-
- /**
- * Return the imap server.
- *
- * @return string The imap host for the current user.
- */
- public function getImapServer()
- {
- return $this->_session->getImapServer();
- }
-
- /**
- * Return the freebusy server.
- *
- * @return string The freebusy host for the current user.
- */
- public function getFreebusyServer()
- {
- return $this->_session->getFreebusyServer();
- }
-
- /**
- * Return a connection to the Kolab storage system.
- *
- * @return Horde_Kolab_Storage The storage connection.
- *
- * @todo Adapt to new structure of this class.
- */
- public function getStorage()
- {
- return $this->_session->getStorage();
- }
}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Base.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Base.php
new file mode 100644
index 000000000..4570e33e5
--- /dev/null
+++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Base.php
@@ -0,0 +1,127 @@
+
+ * @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
+ * @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();
+ }
+}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php
index a2a2fb55f..0ba31d610 100644
--- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php
+++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Logged.php
@@ -26,16 +26,9 @@
* @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
@@ -55,7 +48,7 @@ implements Horde_Kolab_Session
Horde_Kolab_Session $session,
$logger
) {
- $this->_session = $session;
+ parent::__construct($session);
$this->_logger = $logger;
}
@@ -90,86 +83,4 @@ implements Horde_Kolab_Session
throw $e;
}
}
-
- /**
- * Return the user id used for connecting the session.
- *
- * @return string The user id.
- */
- public function getId()
- {
- return $this->_session->getId();
- }
-
- /**
- * Set the user id used for connecting the session.
- *
- * @param string $id The user id.
- *
- * @return NULL
- */
- public function setId($id)
- {
- $this->_session->setId($id);
- }
-
- /**
- * Return the users mail address.
- *
- * @return string The users mail address.
- */
- public function getMail()
- {
- return $this->_session->getMail();
- }
-
- /**
- * Return the users uid.
- *
- * @return string The users uid.
- */
- public function getUid()
- {
- return $this->_session->getUid();
- }
-
- /**
- * Return the users name.
- *
- * @return string The users name.
- */
- public function getName()
- {
- return $this->_session->getName();
- }
-
- /**
- * Return the imap server.
- *
- * @return string The imap host for the current user.
- */
- public function getImapServer()
- {
- return $this->_session->getImapServer();
- }
-
- /**
- * Return the freebusy server.
- *
- * @return string The freebusy host for the current user.
- */
- public function getFreebusyServer()
- {
- return $this->_session->getFreebusyServer();
- }
-
- /**
- * Return a connection to the Kolab storage system.
- *
- * @return Horde_Kolab_Storage The storage connection.
- */
- public function getStorage()
- {
- return $this->_session->getStorage();
- }
}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php
index b9d7c5e7d..ee6e656e1 100644
--- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php
+++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Stored.php
@@ -26,16 +26,9 @@
* @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
@@ -59,7 +52,7 @@ implements Horde_Kolab_Session
Horde_Kolab_Session $session,
Horde_Kolab_Session_Storage_Interface $storage
) {
- $this->_session = $session;
+ parent::__construct($session);
$this->_storage = $storage;
}
@@ -87,86 +80,4 @@ implements Horde_Kolab_Session
$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();
- }
}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Singleton.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Singleton.php
deleted file mode 100644
index e32a152fc..000000000
--- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Singleton.php
+++ /dev/null
@@ -1,66 +0,0 @@
-
- * @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
- * @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;
- }
-}
diff --git a/framework/Kolab_Session/package.xml b/framework/Kolab_Session/package.xml
index fa316b7ed..4c0c306af 100644
--- a/framework/Kolab_Session/package.xml
+++ b/framework/Kolab_Session/package.xml
@@ -55,6 +55,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
+
@@ -62,7 +63,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
-
@@ -109,7 +109,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
-
@@ -166,9 +165,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
+
-
@@ -188,7 +187,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
-
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/BaseTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/BaseTest.php
index cd690ac48..d419a433a 100644
--- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/BaseTest.php
+++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/BaseTest.php
@@ -459,9 +459,4 @@ class Horde_Kolab_Session_Class_BaseTest extends Horde_Kolab_Session_SessionTest
$session->connect('userid', array('password' => ''));
$this->assertEquals('localhost', $session->getImapServer());
}
-
- public function testMethodGetstorageHasResultKolabstorageConnectionForTheCurrentUser()
- {
- $this->markTestIncomplete('Not implemented');
- }
}
\ No newline at end of file
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php
index 223be2356..e885bc991 100644
--- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php
+++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php
@@ -80,90 +80,4 @@ extends Horde_Kolab_Session_SessionTestCase
);
$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
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/BaseTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/BaseTest.php
new file mode 100644
index 000000000..93b124a5e
--- /dev/null
+++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/BaseTest.php
@@ -0,0 +1,119 @@
+
+ * @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
+ * @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
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php
index 76148f9c6..68ee12cde 100644
--- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php
+++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/LoggedTest.php
@@ -89,96 +89,4 @@ extends Horde_Kolab_Session_SessionTestCase
} 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
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php
index 59fec163d..50cd9e11c 100644
--- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php
+++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Decorator/StoredTest.php
@@ -59,86 +59,4 @@ extends Horde_Kolab_Session_SessionTestCase
$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
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SessionTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SessionTest.php
deleted file mode 100644
index 66ec59e4c..000000000
--- a/framework/Kolab_Session/test/Horde/Kolab/Session/Integration/SessionTest.php
+++ /dev/null
@@ -1,133 +0,0 @@
-
- * @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
- * @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);
- }
-
-
-}