From: Gunnar Wrobel Date: Tue, 26 Oct 2010 03:52:01 +0000 (+0200) Subject: Adapt to the recent Horde_SessionObjects -> Horde_Session modification. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e539446c8fdf98482b25574acd4090a47300f877;p=horde.git Adapt to the recent Horde_SessionObjects -> Horde_Session modification. --- diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Session.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Session.php new file mode 100644 index 000000000..cbfb97983 --- /dev/null +++ b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Session.php @@ -0,0 +1,70 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Kolab_Session + */ + +/** + * Defines storage containers for the Kolab session information. + * + * Copyright 2009-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_Storage_Session +implements Horde_Kolab_Session_Storage_Interface +{ + /** + * The handler for session objects. + * + * @var array + */ + private $_session; + + /** + * Constructor + * + * @param array $session The session handler. + */ + public function __construct($session) + { + $this->_session = $session; + } + + /** + * Load the session information. + * + * @return Horde_Kolab_Session|boolean The session information or false if + * it could not be loaded. + */ + public function load() + { + return $this->_session['kolab_session']; + } + + /** + * Save the session information. + * + * @param Horde_Kolab_Session $session The session information. + * + * @return NULL + */ + public function save(Horde_Kolab_Session $session) + { + $this->_session['kolab_session'] = $session; + } +} diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Sessionobjects.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Sessionobjects.php deleted file mode 100644 index 80b79cf21..000000000 --- a/framework/Kolab_Session/lib/Horde/Kolab/Session/Storage/Sessionobjects.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Session - */ - -/** - * Defines storage containers for the Kolab session information. - * - * Copyright 2009-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_Storage_Sessionobjects -implements Horde_Kolab_Session_Storage_Interface -{ - /** - * The handler for session objects. - * - * @var Horde_SessionObjects - */ - private $_session_objects; - - /** - * Constructor - * - * @param Horde_SessionObjects $session_objects The session objects handler. - */ - public function __construct(Horde_SessionObjects $session_objects) - { - $this->_session_objects = $session_objects; - } - - /** - * Load the session information. - * - * @return Horde_Kolab_Session|boolean The session information or false if - * it could not be loaded. - */ - public function load() - { - return $this->_session_objects->query('kolab_session'); - } - - /** - * Save the session information. - * - * @param Horde_Kolab_Session $session The session information. - * - * @return NULL - */ - public function save(Horde_Kolab_Session $session) - { - $this->_session_objects->overwrite('kolab_session', $session); - } -} diff --git a/framework/Kolab_Session/package.xml b/framework/Kolab_Session/package.xml index d0c13d6b5..c02fceb36 100644 --- a/framework/Kolab_Session/package.xml +++ b/framework/Kolab_Session/package.xml @@ -1,14 +1,10 @@ - + Kolab_Session pear.horde.org A package managing an active Kolab session. This package handles a Kolab session. It allows to - authenticate against LDAP and provides the users storage locations. - + authenticate against LDAP and provides the users storage locations. Gunnar Wrobel wrobel @@ -27,7 +23,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> jan@horde.org yes - 2010-03-02 + 2010-10-26 + 0.1.0 0.1.0 @@ -38,39 +35,39 @@ http://pear.php.net/dtd/package-2.0.xsd"> LGPL - * Split package from Kolab_Server +* Split package from Kolab_Server - + - - - - + - + - - - + + + - - + + - - + + + + + @@ -78,30 +75,31 @@ http://pear.php.net/dtd/package-2.0.xsd"> - - - + - + - + + + + @@ -136,36 +134,52 @@ http://pear.php.net/dtd/package-2.0.xsd"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.1.0 + 0.1.0 + + + alpha + alpha + + 2010-10-26 + LGPL + +* Split package from Kolab_Server + + diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionTest.php new file mode 100644 index 000000000..434d2ce4f --- /dev/null +++ b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionTest.php @@ -0,0 +1,55 @@ + + * @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 session based storage driver. + * + * 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_Storage_SessionTest extends Horde_Kolab_Session_SessionTestCase +{ + public function testMethodLoadHasResultQueriedObject() + { + $session = $this->getMock('ArrayAccess', array(), array(), '', false, false); + $session->expects($this->once()) + ->method('offsetGet') + ->with('kolab_session'); + $storage = new Horde_Kolab_Session_Storage_Session($session); + $storage->load(); + } + + public function testMethodSaveHasPostconditionThatTheSessionDataWasSaved() + { + $session = $this->getMock('ArrayAccess', array(), array(), '', false, false); + $session->expects($this->once()) + ->method('offsetSet') + ->with('kolab_session', $this->isInstanceOf('Horde_Kolab_Session')); + $kolab_session = $this->getMock('Horde_Kolab_Session'); + $storage = new Horde_Kolab_Session_Storage_Session($session); + $storage->save($kolab_session); + } +} \ No newline at end of file diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php deleted file mode 100644 index 92d7dd46e..000000000 --- a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Storage/SessionobjectsTest.php +++ /dev/null @@ -1,55 +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 sessionobjects storage driver. - * - * 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_Storage_SessionobjectsTest extends Horde_Kolab_Session_SessionTestCase -{ - public function testMethodLoadHasResultQueriedObject() - { - $session_objects = $this->getMock('Horde_SessionObjects', array(), array(), '', false, false); - $session_objects->expects($this->once()) - ->method('query') - ->with('kolab_session'); - $storage = new Horde_Kolab_Session_Storage_Sessionobjects($session_objects); - $storage->load(); - } - - public function testMethodSaveHasPostconditionThatTheSessionDataWasSaved() - { - $session_objects = $this->getMock('Horde_SessionObjects', array(), array(), '', false, false); - $session_objects->expects($this->once()) - ->method('overwrite') - ->with('kolab_session', $this->isInstanceOf('Horde_Kolab_Session')); - $session = $this->getMock('Horde_Kolab_Session'); - $storage = new Horde_Kolab_Session_Storage_Sessionobjects($session_objects); - $storage->save($session); - } -} \ No newline at end of file