From 0414ad89e5f87d71ab0413f1a64d65442f54b20b Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Tue, 16 Mar 2010 20:30:30 +0100 Subject: [PATCH] Condense the factory experiments from Horde_Kolab_Server into a single factory in Horde_Core. --- .../lib/Horde/Core/Factory/KolabServer.php} | 208 ++++++++------ framework/Core/lib/Horde/Registry.php | 1 + framework/Core/package.xml | 13 + framework/Core/test/Horde/Core/AllTests.php | 38 +++ framework/Core/test/Horde/Core/Autoload.php | 28 ++ .../test/Horde/Core/Factory/KolabServerTest.php | 317 +++++++++++++++++++++ framework/Core/test/Horde/Core/phpunit.xml | 8 + .../lib/Horde/Kolab/Server/Factory/Base.php | 141 --------- .../Horde/Kolab/Server/Factory/Configuration.php | 173 ----------- .../Horde/Kolab/Server/Factory/Connection/Base.php | 64 ----- .../Server/Factory/Connection/Configuration.php | 92 ------ .../Kolab/Server/Factory/Connection/Injector.php | 66 ----- .../Kolab/Server/Factory/Connection/Interface.php | 52 ---- .../Horde/Kolab/Server/Factory/Connection/Ldap.php | 84 ------ .../Horde/Kolab/Server/Factory/Connection/Mock.php | 51 ---- .../lib/Horde/Kolab/Server/Factory/Constructor.php | 133 --------- .../Horde/Kolab/Server/Factory/Decorator/Clean.php | 144 ---------- .../Horde/Kolab/Server/Factory/Decorator/Count.php | 156 ---------- .../Horde/Kolab/Server/Factory/Decorator/Log.php | 156 ---------- .../Horde/Kolab/Server/Factory/Decorator/Map.php | 156 ---------- .../lib/Horde/Kolab/Server/Factory/Default.php | 64 ----- .../lib/Horde/Kolab/Server/Factory/Interface.php | 95 ------ .../lib/Horde/Kolab/Server/Factory/Kolab.php | 42 --- framework/Kolab_Server/package.xml | 70 ----- .../Class/Server/Factory/ConfigurationTest.php | 177 ------------ .../Factory/Connection/ConfigurationTest.php | 80 ------ .../Server/Factory/Connection/InjectorTest.php | 53 ---- .../Class/Server/Factory/Connection/LdapTest.php | 125 -------- .../Class/Server/Factory/Connection/MockTest.php | 84 ------ .../Class/Server/Factory/ConstructorTest.php | 170 ----------- .../Class/Server/Factory/Decorator/CleanTest.php | 166 ----------- .../Class/Server/Factory/Decorator/CountTest.php | 163 ----------- .../Class/Server/Factory/Decorator/LogTest.php | 163 ----------- .../Class/Server/Factory/Decorator/MapTest.php | 164 ----------- .../Server/Class/Server/Factory/InjectorTest.php | 161 ----------- .../Server/Class/Server/Factory/KolabTest.php | 189 ------------ .../Integration/SearchguidforuidormailTest.php | 35 ++- framework/Share/Share/kolab.php | 4 +- 38 files changed, 547 insertions(+), 3539 deletions(-) rename framework/{Kolab_Server/lib/Horde/Kolab/Server/Factory/Injector.php => Core/lib/Horde/Core/Factory/KolabServer.php} (60%) create mode 100644 framework/Core/test/Horde/Core/AllTests.php create mode 100644 framework/Core/test/Horde/Core/Autoload.php create mode 100644 framework/Core/test/Horde/Core/Factory/KolabServerTest.php create mode 100644 framework/Core/test/Horde/Core/phpunit.xml delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Base.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Configuration.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Base.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Configuration.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Injector.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Interface.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Mock.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Constructor.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Clean.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Count.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Log.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Map.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Default.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Interface.php delete mode 100644 framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Kolab.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CleanTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CountTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/LogTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/MapTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/InjectorTest.php delete mode 100644 framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/KolabTest.php diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Injector.php b/framework/Core/lib/Horde/Core/Factory/KolabServer.php similarity index 60% rename from framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Injector.php rename to framework/Core/lib/Horde/Core/Factory/KolabServer.php index 55a6bffc3..9115737aa 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Injector.php +++ b/framework/Core/lib/Horde/Core/Factory/KolabServer.php @@ -1,14 +1,14 @@ * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server + * @link http://pear.horde.org/index.php?package=Core */ /** @@ -19,14 +19,13 @@ * 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_Server + * @category Horde + * @package Core * @author Gunnar Wrobel * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server + * @link http://pear.horde.org/index.php?package=Core */ -class Horde_Kolab_Server_Factory_Injector -implements Horde_Kolab_Server_Factory_Interface +class Horde_Core_Factory_KolabServer { /** * The injector. @@ -43,77 +42,75 @@ implements Horde_Kolab_Server_Factory_Interface public function __construct( Horde_Injector $injector ) { - $this->_injector = $injector; + $this->_injector = $injector; $this->_setup(); } /** - * Prepares the injector with basic configuration information. - * - * @param string $factory The class name of the conn connection - * factory. - * @param array $config Configuration parameters for the server. - * @param Horde_Injector $injector The injector to use. + * Setup the machinery to create Horde_Kolab_Server objects. * * @return NULL */ - static public function setup( - $factory, - array $config, - Horde_Injector $injector - ) { - self::_setupConfiguration($config, $injector); - self::_setupConnectionFactory($factory, $injector); + private function _setup() + { + $this->_setupConfiguration(); + $this->_setupConnection(); + $this->_setupObjects(); + $this->_setupSearch(); + $this->_setupSchema(); + $this->_setupStructure(); + $this->_setupServer(); } /** * Inject the server configuration. * - * @param array $config Configuration parameters for the server. - * @param Horde_Injector $injector The injector to use. - * * @return NULL */ - static private function _setupConfiguration( - array $config, - Horde_Injector $injector - ) { - $injector->setInstance( - 'Horde_Kolab_Server_Configuration', $config - ); - } + private function _setupConfiguration() + { + $configuration = array(); - /** - * Setup the machinery to create a Horde_Kolab_Server_Factory_Conn. - * - * @param string $factory The class name of the conn connection - * factory. - * @param Horde_Injector $injector The injector to use. - * - * @return NULL - */ - static private function _setupConnectionFactory( - $factory, - Horde_Injector $injector - ) { - $injector->bindImplementation( - 'Horde_Kolab_Server_Factory_Connection_Interface', $factory + //@todo: Update configuration parameters + if (!empty($GLOBALS['conf']['kolab']['ldap'])) { + $configuration = $GLOBALS['conf']['kolab']['ldap']; + } + if (!empty($GLOBALS['conf']['kolab']['server'])) { + $configuration = $GLOBALS['conf']['kolab']['server']; + } + + if (isset($configuration['server'])) { + $configuration['host'] = $configuration['server']; + unset($configuration['server']); + } + + if (isset($configuration['phpdn'])) { + $configuration['binddn'] = $configuration['phpdn']; + unset($configuration['phpdn']); + } + + if (isset($configuration['phppw'])) { + $configuration['bindpw'] = $configuration['phppw']; + unset($configuration['phppw']); + } + + $this->_injector->setInstance( + 'Horde_Kolab_Server_Configuration', $configuration ); } /** - * Setup the machinery to create Horde_Kolab_Server objects. + * Setup the machinery to create a Horde_Kolab_Server_Connection. * * @return NULL */ - private function _setup() + private function _setupConnection() { - $this->_setupObjects(); - $this->_setupSearch(); - $this->_setupSchema(); - $this->_setupStructure(); - $this->_setupConnection(); - $this->_setupServer(); + $this->_injector->bindFactory( + 'Horde_Kolab_Server_Connection', + 'Horde_Core_Factory_KolabServer', + 'getConnection' + ); } /** @@ -179,25 +176,11 @@ implements Horde_Kolab_Server_Factory_Interface * * @return NULL */ - private function _setupConnection() - { - $this->_injector->bindFactory( - 'Horde_Kolab_Server_Connection_Interface', - 'Horde_Kolab_Server_Factory_Connection_Injector', - 'getConnection' - ); - } - - /** - * Setup the machinery to create a Horde_Kolab_Server. - * - * @return NULL - */ private function _setupServer() { $this->_injector->bindFactory( 'Horde_Kolab_Server_Interface', - 'Horde_Kolab_Server_Factory_Injector', + 'Horde_Core_Factory_KolabServer', 'getServer' ); } @@ -207,23 +190,40 @@ implements Horde_Kolab_Server_Factory_Interface * * @return Horde_Kolab_Server The Horde_Kolab_Server connection. */ - public function getConnectionFactory() - { - return $this->_injector->getInstance( - 'Horde_Kolab_Server_Factory_Connection_Interface' - ); - } - - /** - * Return the conn server connection that should be used. - * - * @return Horde_Kolab_Server The Horde_Kolab_Server connection. - */ public function getConnection() { - return $this->_injector->getInstance( - 'Horde_Kolab_Server_Connection_Interface' - ); + $configuration = $this->_injector->getInstance('Horde_Kolab_Server_Configuration'); + if (empty($configuration['mock'])) { + if (!isset($configuration['basedn'])) { + throw new Horde_Exception('The parameter \'basedn\' is missing in the Kolab server configuration!'); + } + + $ldap_read = new Horde_Ldap($configuration); + if (isset($configuration['host_master'])) { + $configuration['host'] = $configuration['host_master']; + $ldap_write = new Horde_Ldap($configuration); + $connection = new Horde_Kolab_Server_Connection_Splittedldap( + $ldap_read, $ldap_write + ); + } else { + $connection = new Horde_Kolab_Server_Connection_Simpleldap( + $ldap_read + ); + } + return $connection; + } else { + if (isset($configuration['data'])) { + $data = $configuration['data']; + } else { + $data = array(); + } + $connection = new Horde_Kolab_Server_Connection_Mock( + new Horde_Kolab_Server_Connection_Mock_Ldap( + $configuration, $data + ) + ); + return $connection; + } } /** @@ -245,7 +245,7 @@ implements Horde_Kolab_Server_Factory_Interface { $configuration = $this->getConfiguration(); if (!isset($configuration['basedn'])) { - throw new Horde_Kolab_Server_Exception('The base DN is missing!'); + throw new Horde_Exception('The parameter \'basedn\' is missing in the Kolab server configuration!'); } $connection = $this->getConnection(); @@ -262,6 +262,30 @@ implements Horde_Kolab_Server_Factory_Interface $configuration['filter'] ); } + + if (isset($configuration['map'])) { + $server = new Horde_Kolab_Server_Decorator_Map( + $server, $configuration['map'] + ); + } + + if (isset($configuration['debug']) || isset($configuration['log'])) { + $server = new Horde_Kolab_Server_Decorator_Log( + $server, $this->_injector->getInstance('Horde_Log_Logger') + ); + } + + if (isset($configuration['debug']) || isset($configuration['count'])) { + $server = new Horde_Kolab_Server_Decorator_Count( + $server, $this->_injector->getInstance('Horde_Log_Logger') + ); + } + + if (!empty($configuration['cleanup'])) { + $server = new Horde_Kolab_Server_Decorator_Clean( + $server + ); + } return $server; } @@ -323,8 +347,12 @@ implements Horde_Kolab_Server_Factory_Interface */ public function getComposite() { - return $this->_injector->getInstance( - 'Horde_Kolab_Server_Composite' + return new Horde_Kolab_Server_Composite( + $this->getServer(), + $this->getObjects(), + $this->getStructure(), + $this->getSearch(), + $this->getSchema() ); } } \ No newline at end of file diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index 6642d5056..602a190a0 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -238,6 +238,7 @@ class Horde_Registry $injector->addBinder('Horde_Perms', new Horde_Core_Binder_Perms()); $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'); $GLOBALS['registry'] = $this; $injector->setInstance('Horde_Registry', $this); diff --git a/framework/Core/package.xml b/framework/Core/package.xml index 1fbdb195e..23b2a1df0 100644 --- a/framework/Core/package.xml +++ b/framework/Core/package.xml @@ -72,6 +72,9 @@ Application Framework. + + + @@ -103,6 +106,12 @@ Application Framework. + + + + + + @@ -175,6 +184,7 @@ Application Framework. + @@ -190,6 +200,9 @@ Application Framework. + + + diff --git a/framework/Core/test/Horde/Core/AllTests.php b/framework/Core/test/Horde/Core/AllTests.php new file mode 100644 index 000000000..30a445e9b --- /dev/null +++ b/framework/Core/test/Horde/Core/AllTests.php @@ -0,0 +1,38 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Core + */ + +/** + * Define the main method + */ +if (!defined('PHPUnit_MAIN_METHOD')) { + define('PHPUnit_MAIN_METHOD', 'Horde_Core_AllTests::main'); +} + +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; + +/** + * @package Horde_Core + * @subpackage UnitTests + */ +class Horde_Core_AllTests extends Horde_Test_AllTests +{ +} + +Horde_Core_AllTests::init('Horde_Core', __FILE__); + +if (PHPUnit_MAIN_METHOD == 'Horde_Core_AllTests::main') { + Horde_Core_AllTests::main(); +} diff --git a/framework/Core/test/Horde/Core/Autoload.php b/framework/Core/test/Horde/Core/Autoload.php new file mode 100644 index 000000000..c6bef89d6 --- /dev/null +++ b/framework/Core/test/Horde/Core/Autoload.php @@ -0,0 +1,28 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Core + */ + +if (!spl_autoload_functions()) { + spl_autoload_register( + create_function( + '$class', + '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class);' + . '$err_mask = E_ALL ^ E_WARNING;' + . '$oldErrorReporting = error_reporting($err_mask);' + . 'include "$filename.php";' + . 'error_reporting($oldErrorReporting);' + ) + ); +} + +/** Catch strict standards */ +error_reporting(E_ALL | E_STRICT); diff --git a/framework/Core/test/Horde/Core/Factory/KolabServerTest.php b/framework/Core/test/Horde/Core/Factory/KolabServerTest.php new file mode 100644 index 000000000..5a7e52503 --- /dev/null +++ b/framework/Core/test/Horde/Core/Factory/KolabServerTest.php @@ -0,0 +1,317 @@ + + * @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_Server 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 + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Core + */ +class Horde_Core_Factory_KolabServerTest extends PHPUnit_Framework_TestCase +{ + public function setUp() + { + $GLOBALS['conf']['kolab']['server']['basedn'] = 'test'; + $this->factory = $this->getMock( + 'Horde_Core_Factory_KolabServer', array(), array(), '', false, false + ); + $this->objects = $this->getMock( + 'Horde_Kolab_Server_Objects_Interface' + ); + $this->structure = $this->getMock( + 'Horde_Kolab_Server_Structure_Interface' + ); + $this->search = $this->getMock( + 'Horde_Kolab_Server_Search_Interface' + ); + $this->schema = $this->getMock( + 'Horde_Kolab_Server_Schema_Interface' + ); + } + + private function _getFactory(array $configuration = array()) + { + return new Horde_Core_Factory_KolabServer( + new Horde_Injector(new Horde_Injector_TopLevel()) + ); + } + + public function testMethodGetserverReturnsServer() + { + $factory = $this->_getFactory(); + $this->assertType('Horde_Kolab_Server_Interface', $factory->getServer()); + } + + public function testMethodGetconfigurationReturnsArrayConfiguration() + { + $factory = $this->_getFactory(); + $this->assertEquals( + array('basedn' => 'test'), $factory->getConfiguration() + ); + } + + public function testMethodGetconnectionHasResultConnection() + { + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Connection_Interface', + $factory->getConnection() + ); + } + + public function testMethodConstructHasResultMockConnectionIfConfiguredThatWay() + { + $GLOBALS['conf']['kolab']['server']['mock'] = true; + $factory = $this->_getFactory(); + $this->assertType('Horde_Kolab_Server_Connection_Mock', $factory->getConnection()); + } + + public function testMethodGetconnectionHasResultMockConnectionWithDataIfConfiguredThatWay() + { + $GLOBALS['conf']['kolab']['server']['mock'] = true; + $GLOBALS['conf']['kolab']['server']['data'] = array(); + $factory = $this->_getFactory(); + $this->assertType('Horde_Kolab_Server_Connection_Mock', $factory->getConnection()); + } + + public function testMethodConstructHasResultSimpleConnectionByDefault() + { + $factory = $this->_getFactory(); + $this->assertType('Horde_Kolab_Server_Connection_SimpleLdap', $factory->getConnection()); + } + + public function testMethodConstructHasResultSplittedLdapIfConfiguredThatWay() + { + $GLOBALS['conf']['kolab']['server']['host_master'] = 'master'; + $factory = $this->_getFactory(); + $this->assertType('Horde_Kolab_Server_Connection_SplittedLdap', $factory->getConnection()); + } + + public function testMethodGetserverHasResultServerldapstandard() + { + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Ldap_Standard', + $factory->getServer() + ); + } + + public function testMethodGetserverThrowsExceptionIfTheBaseDnIsMissingInTheConfiguration() + { + unset($GLOBALS['conf']); + $factory = $this->_getFactory(); + try { + $factory->getServer(); + $this->fail('No exception!'); + } catch (Horde_Exception $e) { + $this->assertEquals( + 'The parameter \'basedn\' is missing in the Kolab server configuration!', + $e->getMessage() + ); + } + } + + public function testMethodGetconnectionThrowsExceptionIfTheBaseDnIsMissingInTheConfiguration() + { + unset($GLOBALS['conf']); + $factory = $this->_getFactory(); + try { + $factory->getConnection(); + $this->fail('No exception!'); + } catch (Horde_Exception $e) { + $this->assertEquals( + 'The parameter \'basedn\' is missing in the Kolab server configuration!', + $e->getMessage() + ); + } + } + + public function testMethodGetserverHasResultServerldapFilteredIfAFilterWasSet() + { + $GLOBALS['conf']['kolab']['server']['filter'] = 'filter'; + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Ldap_Filtered', + $factory->getServer() + ); + } + + public function testMethodGetobjectsHasResultObjects() + { + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Objects_Interface', + $factory->getObjects() + ); + } + + public function testMethodGetstructureHasResultStructureKolab() + { + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Structure_Kolab', + $factory->getStructure() + ); + } + + public function testMethodGetstructureHasResultStructureLdapIfConfiguredThatWay() + { + $GLOBALS['conf']['kolab']['server']['structure'] = array( + 'driver' => 'Horde_Kolab_Server_Structure_Ldap' + ); + $factory = $this->_getFactory(); + $this->assertNotType( + 'Horde_Kolab_Server_Structure_Kolab', + $factory->getStructure() + ); + } + + public function testMethodGetsearchHasResultSearch() + { + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Search_Interface', + $factory->getSearch() + ); + } + + public function testMethodGetschemaHasResultSchema() + { + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Schema_Interface', + $factory->getSchema() + ); + } + + public function testMethodGetcompositeReturnsComposite() + { + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Composite', + $factory->getComposite() + ); + } + + public function testMethodGetserverHasResultCountedServerIfCountingWasActivatedInTheConfiguration() + { + $GLOBALS['conf']['kolab']['server']['count'] = true; + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Decorator_Count', $factory->getServer() + ); + } + + public function testMethodGetserverHasResultLoggedServerIfLoggingWasActivatedInTheConfiguration() + { + $GLOBALS['conf']['kolab']['server']['log'] = true; + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Decorator_Log', $factory->getServer() + ); + } + + public function testMethodGetserverHasResultMappedServerIfAMappedWasProvidedInTheConfiguration() + { + $GLOBALS['conf']['kolab']['server']['map'] = array(); + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Decorator_Map', $factory->getServer() + ); + } + + public function testMethodGetserverHasResultCleanerServerIfACleanedWasProvidedInTheConfiguration() + { + $GLOBALS['conf']['kolab']['server']['cleanup'] = true; + $factory = $this->_getFactory(); + $this->assertType( + 'Horde_Kolab_Server_Decorator_Clean', $factory->getServer() + ); + } + + public function testMethodGetconfigurationHasResultArray() + { + $factory = $this->_getFactory(); + $this->assertType( + 'array', + $factory->getConfiguration() + ); + } + + public function testMethodGetconfigurationHasResultRewrittenServerParameter() + { + $GLOBALS['conf']['kolab']['server']['server'] = 'a'; + $factory = $this->_getFactory(); + $this->assertEquals( + array( + 'basedn' => 'test', + 'host' => 'a' + ), + $factory->getConfiguration() + ); + } + + public function testMethodGetconfigurationHasResultRewrittenPhpdnParameter() + { + $GLOBALS['conf']['kolab']['server']['phpdn'] = 'a'; + $factory = $this->_getFactory(); + $this->assertEquals( + array( + 'basedn' => 'test', + 'binddn' => 'a' + ), + $factory->getConfiguration() + ); + } + + public function testMethodGetconfigurationHasResultRewrittenPhppwParameter() + { + $GLOBALS['conf']['kolab']['server']['phppw'] = 'a'; + $factory = $this->_getFactory(); + $this->assertEquals( + array( + 'basedn' => 'test', + 'bindpw' => 'a' + ), + $factory->getConfiguration() + ); + } + + public function testMethodGetconfigurationRewritesOldConfiguration() + { + unset($GLOBALS['conf']['kolab']['server']); + $GLOBALS['conf']['kolab']['ldap']['basedn'] = 'test'; + $GLOBALS['conf']['kolab']['ldap']['phppw'] = 'a'; + $factory = $this->_getFactory(); + $this->assertEquals( + array( + 'basedn' => 'test', + 'bindpw' => 'a' + ), + $factory->getConfiguration() + ); + } +} \ No newline at end of file diff --git a/framework/Core/test/Horde/Core/phpunit.xml b/framework/Core/test/Horde/Core/phpunit.xml new file mode 100644 index 000000000..502d3c9b8 --- /dev/null +++ b/framework/Core/test/Horde/Core/phpunit.xml @@ -0,0 +1,8 @@ + + + + + ../../../lib + + + diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Base.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Base.php deleted file mode 100644 index 2d3c685e2..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Base.php +++ /dev/null @@ -1,141 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Basic server factory functionality. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -abstract class Horde_Kolab_Server_Factory_Base -implements Horde_Kolab_Server_Factory_Interface -{ - /** - * The connection factory. - * - * @param Horde_Kolab_Server_Factory_Core - */ - private $_conn_factory; - - /** - * The server configuration parameters - * - * @param array - */ - private $_configuration; - - /** - * Constructor. - * - * @param Horde_Kolab_Server_Factory_Conn $factory The server connection - * factory. - * @param array $config Configuration - * parameters for the - * server. - */ - public function __construct( - Horde_Kolab_Server_Factory_Connection_Interface $factory, - array $config - ) { - $this->_conn_factory = $factory; - $this->_configuration = $config; - } - - /** - * Returns the conn factory. - * - * @return Horde_Kolab_Server_Factory_Conn The connection factory. - */ - public function getConnectionFactory() - { - return $this->_conn_factory; - } - - /** - * Returns the server configuration parameters. - * - * @return array The configuration parameters. - */ - public function getConfiguration() - { - return $this->_configuration; - } - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server The Horde_Kolab_Server connection. - */ - public function getServer() - { - $configuration = $this->getConfiguration(); - if (!isset($configuration['basedn'])) { - throw new Horde_Kolab_Server_Exception('The base DN is missing'); - } - - $connection = $this->getConnection(); - - if (!isset($configuration['filter'])) { - $server = new Horde_Kolab_Server_Ldap_Standard( - $connection, - $configuration['basedn'] - ); - } else { - $server = new Horde_Kolab_Server_Ldap_Filtered( - $connection, - $configuration['basedn'], - $configuration['filter'] - ); - } - return $server; - } - - /** - * Return the server that should be used. - * - * @return Horde_Kolab_Server_Connection The connection. - */ - public function getConnection() - { - $factory = $this->getConnectionFactory(); - $factory->setConfiguration($this->getConfiguration()); - return $factory->getConnection(); - } - - /** - * Returns a concrete Horde_Kolab_Server_Composite instance. - * - * @return Horde_Kolab_Server_Composite The newly created concrete - * Horde_Kolab_Server_Composite - * instance. - */ - public function getComposite() - { - $composite = new Horde_Kolab_Server_Composite( - $this->getServer(), - $this->getObjects(), - $this->getStructure(), - $this->getSearch(), - $this->getSchema() - ); - return $composite; - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Configuration.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Configuration.php deleted file mode 100644 index 3dd8a2902..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Configuration.php +++ /dev/null @@ -1,173 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A factory that receives all required details via configuration parameters. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Configuration -implements Horde_Kolab_Server_Factory_Interface -{ - /** - * Configuration parameters for the server. - * - * @var array - */ - private $_configuration; - - /** - * The factory used for creating the instances. - * - * @var Horde_Kolab_Server_Factory - */ - private $_factory; - - /** - * Constructor. - */ - public function __construct(array $config) - { - $this->_configuration = $config; - - $connection_factory = new Horde_Kolab_Server_Factory_Connection_Configuration( - $config - ); - $factory = new Horde_Kolab_Server_Factory_Kolab( - $connection_factory, $config - ); - - if (isset($config['logger'])) { - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $factory, $config['logger'] - ); - } - - if (isset($config['map'])) { - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $factory, $config['map'] - ); - } - - if (!empty($config['cleanup'])) { - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $factory - ); - } - - $this->_factory = $factory; - } - - /** - * Returns the conn factory. - * - * @return Horde_Kolab_Server_Factory_Conn The connection factory. - */ - public function getConnectionFactory() - { - return $this->_factory->getConnectionFactory(); - } - - /** - * Returns the server configuration parameters. - * - * @return array The configuration parameters. - */ - public function getConfiguration() - { - return $this->_factory->getConfiguration(); - } - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server The Horde_Kolab_Server connection. - */ - public function getServer() - { - return $this->_factory->getServer(); - } - - /** - * Return the server that should be used. - * - * @return Horde_Kolab_Server_Connection The connection. - */ - public function getConnection() - { - return $this->_factory->getConnection(); - } - - /** - * Returns a concrete Horde_Kolab_Server_Composite instance. - * - * @return Horde_Kolab_Server_Composite The newly created concrete - * Horde_Kolab_Server_Composite - * instance. - */ - public function getComposite() - { - return $this->_factory->getComposite(); - } - - /** - * Return the object handler that should be used. - * - * @return Horde_Kolab_Server_Objects The handler for objects on the server. - */ - public function getObjects() - { - return $this->_factory->getObjects(); - } - - /** - * Return the structural representation that should be used. - * - * @return Horde_Kolab_Server_Structure The representation of the db - * structure. - */ - public function getStructure() - { - return $this->_factory->getStructure(); - } - - /** - * Return the search handler that should be used. - * - * @return Horde_Kolab_Server_Search The search handler. - */ - public function getSearch() - { - return $this->_factory->getSearch(); - } - - /** - * Return the db schema representation that should be used. - * - * @return Horde_Kolab_Server_Schema The db schema representation. - */ - public function getSchema() - { - return $this->_factory->getSchema(); - } - -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Base.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Base.php deleted file mode 100644 index c2b97a99a..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Base.php +++ /dev/null @@ -1,64 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A base connection factory definition. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -abstract class Horde_Kolab_Server_Factory_Connection_Base -implements Horde_Kolab_Server_Factory_Connection_Interface -{ - /** - * Connection parameters. - * - * @var array - */ - private $_configuration; - - /** - * Get the connection configuration. - * - * @return array $configuration The configuration parameters. - */ - public function getConfiguration() - { - if (!isset($this->_configuration)) { - throw new Horde_Kolab_Server_Exception( - 'The configuration has not been set!' - ); - } - return $this->_configuration; - } - - /** - * Set the connection configuration. - * - * @param array $configuration The configuration parameters. - * - * @return NULL - */ - public function setConfiguration(array $configuration) - { - $this->_configuration = $configuration; - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Configuration.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Configuration.php deleted file mode 100644 index 9dcc9d289..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Configuration.php +++ /dev/null @@ -1,92 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Connection_Configuration -extends Horde_Kolab_Server_Factory_Connection_Base -{ - /** - * Configuration parameters for the connection. - * - * @var array - */ - private $_configuration; - - /** - * The factory used for creating the instances. - * - * @var Horde_Kolab_Server_Factory - */ - private $_factory; - - /** - * Constructor. - */ - public function __construct(array $config) - { - $this->setConfiguration($config); - } - - /** - * Get the connection configuration. - * - * @return array $configuration The configuration parameters. - */ - public function getConfiguration() - { - return $this->_configuration; - } - - /** - * Set the connection configuration. - * - * @param array $configuration The configuration parameters. - * - * @return NULL - */ - public function setConfiguration(array $configuration) - { - $this->_configuration = $configuration; - - if (empty($configuration['mock'])) { - $this->_factory = new Horde_Kolab_Server_Factory_Connection_Ldap(); - } else { - $this->_factory = new Horde_Kolab_Server_Factory_Connection_Mock(); - } - - $this->_factory->setConfiguration($configuration); - } - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server_Connection The server connection. - */ - public function getConnection() - { - return $this->_factory->getConnection(); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Injector.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Injector.php deleted file mode 100644 index fed6780d1..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Injector.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_Server - */ - -/** - * A factory that generates connections using the Horde_Injector. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Connection_Injector -extends Horde_Kolab_Server_Factory_Connection_Base -{ - /** - * The injector providing our context. - * - * @var Horde_Injector - */ - private $_injector; - - /** - * Constructor. - * - * @param Horde_Injector The injector to use. - */ - public function __construct(Horde_Injector $injector) - { - $this->_injector = $injector; - } - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server_Connection The server connection. - */ - public function getConnection() - { - $factory = $this->_injector->getInstance( - 'Horde_Kolab_Server_Factory_Connection_Interface' - ); - $factory->setConfiguration( - $this->_injector->getInstance( - 'Horde_Kolab_Server_Configuration' - ) - ); - $connection = $factory->getConnection(); - return $connection; - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Interface.php deleted file mode 100644 index ef1039bd7..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Interface.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * The interface of Kolab server connection factories. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -interface Horde_Kolab_Server_Factory_Connection_Interface -{ - /** - * Get the connection configuration. - * - * @return array $configuration The configuration parameters. - */ - public function getConfiguration(); - - /** - * Set the connection configuration. - * - * @param array $configuration The configuration parameters. - * - * @return NULL - */ - public function setConfiguration(array $configuration); - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server_Connection The server connection. - */ - public function getConnection(); -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php deleted file mode 100644 index 3a241f39c..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php +++ /dev/null @@ -1,84 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A factory that generates LDAP connections. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Connection_Ldap -extends Horde_Kolab_Server_Factory_Connection_Base -{ - /** - * Set the connection configuration. - * - * @param array $configuration The configuration parameters. - * - * @return NULL - */ - public function setConfiguration(array $configuration) - { - if (!isset($configuration['basedn'])) { - throw new Horde_Kolab_Server_Exception('The base DN is missing!'); - } - - if (isset($configuration['server'])) { - $configuration['host'] = $configuration['server']; - unset($configuration['server']); - } - - if (isset($configuration['phpdn'])) { - $configuration['binddn'] = $configuration['phpdn']; - unset($configuration['phpdn']); - } - - if (isset($configuration['phppw'])) { - $configuration['bindpw'] = $configuration['phppw']; - unset($configuration['phppw']); - } - - parent::setConfiguration($configuration); - } - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server_Connection The server connection. - */ - public function getConnection() - { - $configuration = $this->getConfiguration(); - $ldap_read = new Horde_Ldap($configuration); - if (isset($configuration['host_master'])) { - $configuration['host'] = $configuration['host_master']; - $ldap_write = new Horde_Ldap($configuration); - $connection = new Horde_Kolab_Server_Connection_Splittedldap( - $ldap_read, $ldap_write - ); - } else { - $connection = new Horde_Kolab_Server_Connection_Simpleldap( - $ldap_read - ); - } - return $connection; - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Mock.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Mock.php deleted file mode 100644 index 2fe0e3e43..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Mock.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A factory that generates mock connections. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Connection_Mock -extends Horde_Kolab_Server_Factory_Connection_Base -{ - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server_Connection The server connection. - */ - public function getConnection() - { - $config = $this->getConfiguration(); - if (isset($config['data'])) { - $data = $config['data']; - } else { - $data = array(); - } - $connection = new Horde_Kolab_Server_Connection_Mock( - new Horde_Kolab_Server_Connection_Mock_Ldap( - $config, $data - ) - ); - return $connection; - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Constructor.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Constructor.php deleted file mode 100644 index b2c1ae568..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Constructor.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_Server - */ - -/** - * A Kolab server factory that receives all required details via the - * factory constructor. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Constructor -extends Horde_Kolab_Server_Factory_Base -{ - /** - * The implementation representing the db structur. - * - * @param Horde_Kolab_Server_Structure - */ - private $_structure; - - /** - * The search handler. - * - * @param Horde_Kolab_Server_Search - */ - private $_search; - - /** - * Handles the db schema. - * - * @param Horde_Kolab_Server_Schema - */ - private $_schema; - - /** - * The object handler. - * - * @param Horde_Kolab_Server_Objects - */ - private $_objects; - - /** - * Constructor. - * - * @param Horde_Kolab_Server_Factory_Conn $factory The connection - * factory. - * @param Horde_Kolab_Server_Objects $objects The object handler. - * @param Horde_Kolab_Server_Structure $structure The implementation - * representing the db - * structure. - * @param Horde_Kolab_Server_Search $search The search handler. - * @param Horde_Kolab_Server_Schema $schema Handles the db schema. - * @param array $config Configuration - * parameters for the - * server. - */ - public function __construct( - Horde_Kolab_Server_Factory_Connection_Interface $factory, - Horde_Kolab_Server_Objects_Interface $objects, - Horde_Kolab_Server_Structure_Interface $structure, - Horde_Kolab_Server_Search_Interface $search, - Horde_Kolab_Server_Schema_Interface $schema, - array $config - ) { - parent::__construct($factory, $config); - - $this->_objects = $objects; - $this->_structure = $structure; - $this->_search = $search; - $this->_schema = $schema; - } - - /** - * Return the object handler that should be used. - * - * @return Horde_Kolab_Server_Objects The handler for objects on the server. - */ - public function getObjects() - { - return $this->_objects; - } - - /** - * Return the structural representation that should be used. - * - * @return Horde_Kolab_Server_Structure The representation of the db - * structure. - */ - public function getStructure() - { - return $this->_structure; - } - - /** - * Return the search handler that should be used. - * - * @return Horde_Kolab_Server_Search The search handler. - */ - public function getSearch() - { - return $this->_search; - } - - /** - * Return the db schema representation that should be used. - * - * @return Horde_Kolab_Server_Schema The db schema representation. - */ - public function getSchema() - { - return $this->_schema; - } - -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Clean.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Clean.php deleted file mode 100644 index 2dd65f4cd..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Clean.php +++ /dev/null @@ -1,144 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A factory decorator that adds cleaning 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Decorator_Clean -implements Horde_Kolab_Server_Factory_Interface -{ - /** - * The factory used for creating the instances. - * - * @var Horde_Kolab_Server_Factory - */ - private $_factory; - - /** - * Constructor. - * - * @param Horde_Kolab_Server_Factory $factory The base factory. - */ - public function __construct( - Horde_Kolab_Server_Factory_Interface $factory - ) { - $this->_factory = $factory; - } - - /** - * Returns the conn factory. - * - * @return Horde_Kolab_Server_Factory_Conn The connection factory. - */ - public function getConnectionFactory() - { - return $this->_factory->getConnectionFactory(); - } - - /** - * Returns the server configuration parameters. - * - * @return array The configuration parameters. - */ - public function getConfiguration() - { - return $this->_factory->getConfiguration(); - } - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server The Horde_Kolab_Server connection. - */ - public function getServer() - { - $server = $this->_factory->getServer(); - $server = new Horde_Kolab_Server_Decorator_Clean($server); - return $server; - } - - /** - * Return the server that should be used. - * - * @return Horde_Kolab_Server_Connection The connection. - */ - public function getConnection() - { - return $this->_factory->getConnection(); - } - - /** - * Returns a concrete Horde_Kolab_Server_Composite instance. - * - * @return Horde_Kolab_Server_Composite The newly created concrete - * Horde_Kolab_Server_Composite - * instance. - */ - public function getComposite() - { - return $this->_factory->getComposite(); - } - - /** - * Return the object handler that should be used. - * - * @return Horde_Kolab_Server_Objects The handler for objects on the server. - */ - public function getObjects() - { - return $this->_factory->getObjects(); - } - - /** - * Return the structural representation that should be used. - * - * @return Horde_Kolab_Server_Structure The representation of the db - * structure. - */ - public function getStructure() - { - return $this->_factory->getStructure(); - } - - /** - * Return the search handler that should be used. - * - * @return Horde_Kolab_Server_Search The search handler. - */ - public function getSearch() - { - return $this->_factory->getSearch(); - } - - /** - * Return the db schema representation that should be used. - * - * @return Horde_Kolab_Server_Schema The db schema representation. - */ - public function getSchema() - { - return $this->_factory->getSchema(); - } - -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Count.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Count.php deleted file mode 100644 index 09a8e9a57..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Count.php +++ /dev/null @@ -1,156 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A factory decorator that adds counting 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Decorator_Count -implements Horde_Kolab_Server_Factory_Interface -{ - /** - * The factory used for creating the instances. - * - * @var Horde_Kolab_Server_Factory - */ - private $_factory; - - /** - * The logger. - * - * @var mixed - */ - private $_logger; - - /** - * Constructor. - * - * @param Horde_Kolab_Server_Factory $factory The base factory. - * @param mixed $logger The logger isntance. - */ - public function __construct( - Horde_Kolab_Server_Factory_Interface $factory, - $logger - ) { - $this->_factory = $factory; - $this->_logger = $logger; - } - - /** - * Returns the conn factory. - * - * @return Horde_Kolab_Server_Factory_Conn The connection factory. - */ - public function getConnectionFactory() - { - return $this->_factory->getConnectionFactory(); - } - - /** - * Returns the server configuration parameters. - * - * @return array The configuration parameters. - */ - public function getConfiguration() - { - return $this->_factory->getConfiguration(); - } - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server The Horde_Kolab_Server connection. - */ - public function getServer() - { - $server = $this->_factory->getServer(); - $server = new Horde_Kolab_Server_Decorator_Count( - $server, $this->_logger - ); - return $server; - } - - /** - * Return the server that should be used. - * - * @return Horde_Kolab_Server_Connection The connection. - */ - public function getConnection() - { - return $this->_factory->getConnection(); - } - - /** - * Returns a concrete Horde_Kolab_Server_Composite instance. - * - * @return Horde_Kolab_Server_Composite The newly created concrete - * Horde_Kolab_Server_Composite - * instance. - */ - public function getComposite() - { - return $this->_factory->getComposite(); - } - - /** - * Return the object handler that should be used. - * - * @return Horde_Kolab_Server_Objects The handler for objects on the server. - */ - public function getObjects() - { - return $this->_factory->getObjects(); - } - - /** - * Return the structural representation that should be used. - * - * @return Horde_Kolab_Server_Structure The representation of the db - * structure. - */ - public function getStructure() - { - return $this->_factory->getStructure(); - } - - /** - * Return the search handler that should be used. - * - * @return Horde_Kolab_Server_Search The search handler. - */ - public function getSearch() - { - return $this->_factory->getSearch(); - } - - /** - * Return the db schema representation that should be used. - * - * @return Horde_Kolab_Server_Schema The db schema representation. - */ - public function getSchema() - { - return $this->_factory->getSchema(); - } - -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Log.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Log.php deleted file mode 100644 index 1073910c6..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Log.php +++ /dev/null @@ -1,156 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A factory decorator that adds logging to the generated 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Decorator_Log -implements Horde_Kolab_Server_Factory_Interface -{ - /** - * The factory used for creating the instances. - * - * @var Horde_Kolab_Server_Factory - */ - private $_factory; - - /** - * The logger. - * - * @var mixed - */ - private $_logger; - - /** - * Constructor. - * - * @param Horde_Kolab_Server_Factory $factory The base factory. - * @param mixed $logger The logger isntance. - */ - public function __construct( - Horde_Kolab_Server_Factory_Interface $factory, - $logger - ) { - $this->_factory = $factory; - $this->_logger = $logger; - } - - /** - * Returns the conn factory. - * - * @return Horde_Kolab_Server_Factory_Conn The connection factory. - */ - public function getConnectionFactory() - { - return $this->_factory->getConnectionFactory(); - } - - /** - * Returns the server configuration parameters. - * - * @return array The configuration parameters. - */ - public function getConfiguration() - { - return $this->_factory->getConfiguration(); - } - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server The Horde_Kolab_Server connection. - */ - public function getServer() - { - $server = $this->_factory->getServer(); - $server = new Horde_Kolab_Server_Decorator_Log( - $server, $this->_logger - ); - return $server; - } - - /** - * Return the server that should be used. - * - * @return Horde_Kolab_Server_Connection The connection. - */ - public function getConnection() - { - return $this->_factory->getConnection(); - } - - /** - * Returns a concrete Horde_Kolab_Server_Composite instance. - * - * @return Horde_Kolab_Server_Composite The newly created concrete - * Horde_Kolab_Server_Composite - * instance. - */ - public function getComposite() - { - return $this->_factory->getComposite(); - } - - /** - * Return the object handler that should be used. - * - * @return Horde_Kolab_Server_Objects The handler for objects on the server. - */ - public function getObjects() - { - return $this->_factory->getObjects(); - } - - /** - * Return the structural representation that should be used. - * - * @return Horde_Kolab_Server_Structure The representation of the db - * structure. - */ - public function getStructure() - { - return $this->_factory->getStructure(); - } - - /** - * Return the search handler that should be used. - * - * @return Horde_Kolab_Server_Search The search handler. - */ - public function getSearch() - { - return $this->_factory->getSearch(); - } - - /** - * Return the db schema representation that should be used. - * - * @return Horde_Kolab_Server_Schema The db schema representation. - */ - public function getSchema() - { - return $this->_factory->getSchema(); - } - -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Map.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Map.php deleted file mode 100644 index 9e5241bfa..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Decorator/Map.php +++ /dev/null @@ -1,156 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A factory decorator that adds mapping to the generated 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Decorator_Map -implements Horde_Kolab_Server_Factory_Interface -{ - /** - * The factory used for creating the instances. - * - * @var Horde_Kolab_Server_Factory - */ - private $_factory; - - /** - * The attribute mapping. - * - * @var array - */ - private $_mapping; - - /** - * Constructor. - * - * @param Horde_Kolab_Server_Factory $factory The base factory. - * @param array $mapping The attribute mapping. - */ - public function __construct( - Horde_Kolab_Server_Factory_Interface $factory, - array $mapping) - { - $this->_factory = $factory; - $this->_mapping = $mapping; - } - - /** - * Returns the conn factory. - * - * @return Horde_Kolab_Server_Factory_Conn The connection factory. - */ - public function getConnectionFactory() - { - return $this->_factory->getConnectionFactory(); - } - - /** - * Returns the server configuration parameters. - * - * @return array The configuration parameters. - */ - public function getConfiguration() - { - return $this->_factory->getConfiguration(); - } - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server The Horde_Kolab_Server connection. - */ - public function getServer() - { - $server = $this->_factory->getServer(); - $server = new Horde_Kolab_Server_Decorator_Map( - $server, $this->_mapping - ); - return $server; - } - - /** - * Return the server that should be used. - * - * @return Horde_Kolab_Server_Connection The connection. - */ - public function getConnection() - { - return $this->_factory->getConnection(); - } - - /** - * Returns a concrete Horde_Kolab_Server_Composite instance. - * - * @return Horde_Kolab_Server_Composite The newly created concrete - * Horde_Kolab_Server_Composite - * instance. - */ - public function getComposite() - { - return $this->_factory->getComposite(); - } - - /** - * Return the object handler that should be used. - * - * @return Horde_Kolab_Server_Objects The handler for objects on the server. - */ - public function getObjects() - { - return $this->_factory->getObjects(); - } - - /** - * Return the structural representation that should be used. - * - * @return Horde_Kolab_Server_Structure The representation of the db - * structure. - */ - public function getStructure() - { - return $this->_factory->getStructure(); - } - - /** - * Return the search handler that should be used. - * - * @return Horde_Kolab_Server_Search The search handler. - */ - public function getSearch() - { - return $this->_factory->getSearch(); - } - - /** - * Return the db schema representation that should be used. - * - * @return Horde_Kolab_Server_Schema The db schema representation. - */ - public function getSchema() - { - return $this->_factory->getSchema(); - } - -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Default.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Default.php deleted file mode 100644 index 76d03187d..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Default.php +++ /dev/null @@ -1,64 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A Kolab server factory providing defaults where applicable. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -abstract class Horde_Kolab_Server_Factory_Default -extends Horde_Kolab_Server_Factory_Base -{ - /** - * Return the object handler that should be used. - * - * @return Horde_Kolab_Server_Objects The handler for objects on the server. - */ - public function getObjects() - { - $objects = new Horde_Kolab_Server_Objects_Base(); - return $objects; - } - - /** - * Return the search handler that should be used. - * - * @return Horde_Kolab_Server_Search The search handler. - */ - public function getSearch() - { - $search = new Horde_Kolab_Server_Search_Base(); - return $search; - } - - /** - * Return the db schema representation that should be used. - * - * @return Horde_Kolab_Server_Schema The db schema representation. - */ - public function getSchema() - { - $schema = new Horde_Kolab_Server_Schema_Base(); - return $schema; - } - -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Interface.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Interface.php deleted file mode 100644 index 08103972d..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Interface.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * The interface of Kolab server factories. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -interface Horde_Kolab_Server_Factory_Interface -{ - /** - * Returns a concrete Horde_Kolab_Server_Composite instance. - * - * @return Horde_Kolab_Server_Composite The newly created concrete - * Horde_Kolab_Server_Composite - * instance. - */ - public function getComposite(); - - /** - * Returns the conn factory. - * - * @return Horde_Kolab_Server_Factory_Conn The connection factory. - */ - public function getConnectionFactory(); - - /** - * Returns the server configuration parameters. - * - * @return array The configuration parameters. - */ - public function getConfiguration(); - - /** - * Return the server connection that should be used. - * - * @return Horde_Kolab_Server The Horde_Kolab_Server connection. - */ - public function getServer(); - - /** - * Return the server that should be used. - * - * @return Horde_Kolab_Server_Connection The connection. - */ - public function getConnection(); - - /** - * Return the object handler that should be used. - * - * @return Horde_Kolab_Server_Objects The handler for objects on the server. - */ - public function getObjects(); - - /** - * Return the structural representation that should be used. - * - * @return Horde_Kolab_Server_Structure The representation of the db - * structure. - */ - public function getStructure(); - - /** - * Return the search handler that should be used. - * - * @return Horde_Kolab_Server_Search The search handler. - */ - public function getSearch(); - - /** - * Return the db schema representation that should be used. - * - * @return Horde_Kolab_Server_Schema The db schema representation. - */ - public function getSchema(); -} \ No newline at end of file diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Kolab.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Kolab.php deleted file mode 100644 index d107fa175..000000000 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Kolab.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * A Kolab server factory providing the Kolab default. - * - * 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Factory_Kolab -extends Horde_Kolab_Server_Factory_Default -{ - /** - * Return the structural representation that should be used. - * - * @return Horde_Kolab_Server_Structure The representation of the db - * structure. - */ - public function getStructure() - { - $structure = new Horde_Kolab_Server_Structure_Kolab(); - return $structure; - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/package.xml b/framework/Kolab_Server/package.xml index ca01edcd6..671180b48 100644 --- a/framework/Kolab_Server/package.xml +++ b/framework/Kolab_Server/package.xml @@ -97,29 +97,6 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -283,24 +260,6 @@ - - - - - - - - - - - - - - - - - - @@ -430,23 +389,6 @@ - - - - - - - - - - - - - - - - - @@ -563,18 +505,6 @@ - - - - - - - - - - - - diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php deleted file mode 100644 index 67792713b..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php +++ /dev/null @@ -1,177 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Require our basic test case definition - */ -require_once dirname(__FILE__) . '/../../../LdapTestCase.php'; - -/** - * Test the configuration based server 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_ConfigurationTest -extends Horde_Kolab_Server_LdapTestCase -{ - public function testMethodGetserverHasResultLoggedServerIfALoggerWasProvidedInTheConfiguration() - { - $this->skipIfNoLdap(); - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('logger' => 'set', 'basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Decorator_Log', $factory->getServer() - ); - } - - public function testMethodGetserverHasResultMappedServerIfAMappedWasProvidedInTheConfiguration() - { - $this->skipIfNoLdap(); - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('map' => array(), 'basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Decorator_Map', $factory->getServer() - ); - } - - public function testMethodGetserverHasResultCleanerServerIfACleanedWasProvidedInTheConfiguration() - { - $this->skipIfNoLdap(); - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('cleanup' => true, 'basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Decorator_Clean', $factory->getServer() - ); - } - - public function testMethodConstructHasParametersArrayParameters() - { - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - } - - public function testMethodGetconnectionfactoryHasResultServerconnectionfactory() - { - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Factory_Connection_Interface', - $factory->getConnectionFactory() - ); - } - - public function testMethodGetserverHasResultServer() - { - $this->skipIfNoLdap(); - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Interface', - $factory->getServer() - ); - } - - public function testMethodGetconfigurationHasResultArray() - { - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - $this->assertType( - 'array', - $factory->getConfiguration() - ); - } - - public function testMethodGetconnectionHasResultServerconnection() - { - $this->skipIfNoLdap(); - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Connection_Interface', - $factory->getConnection() - ); - } - - public function testMethodGetcompositeHasResultServercomposite() - { - $this->skipIfNoLdap(); - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Composite', - $factory->getComposite() - ); - } - - public function testMethodGetobjectsHasResultServerobjects() - { - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Objects_Interface', - $factory->getObjects() - ); - } - - public function testMethodGetstructureHasresultServerstructure() - { - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Structure_Interface', - $factory->getStructure() - ); - } - - public function testMethodGetsearchHasResultServersearch() - { - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Search_Interface', - $factory->getSearch() - ); - } - - public function testMethodGetschemaHasResultServerschema() - { - $factory = new Horde_Kolab_Server_Factory_Configuration( - array('basedn' => '') - ); - $this->assertType( - 'Horde_Kolab_Server_Schema_Interface', - $factory->getSchema() - ); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php deleted file mode 100644 index 97d6f7d36..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php +++ /dev/null @@ -1,80 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Require our basic test case definition - */ -require_once dirname(__FILE__) . '/../../../../LdapTestCase.php'; - -/** - * Test the configuration based connection 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_Connection_ConfigurationTest -extends Horde_Kolab_Server_LdapTestCase -{ - public function testMethodConstructHasParameterArrayConfiguration() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Configuration( - array('basedn' => 'a') - ); - } - - public function testMethodConstructHasPostconditionThatTheConfigurationWasSaved() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Configuration( - array('basedn' => 'a') - ); - $this->assertEquals(array('basedn' => 'a'), $factory->getConfiguration()); - } - - public function testMethodConstructHasResultArrayTheConfiguration() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Configuration( - array('basedn' => 'a') - ); - $this->assertType('array', $factory->getConfiguration()); - } - - public function testMethodConstructHasPostconditionThatTheConnectionFactoryHasBeenSet() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Configuration( - array('mock' => true) - ); - $this->assertType('Horde_Kolab_Server_Connection_Mock', $factory->getConnection()); - } - - public function testMethodGetconnectionHasResultMockConnectionIfConfiguredThatWay() - { - $this->testMethodConstructHasPostconditionThatTheConnectionFactoryHasBeenSet(); - } - - public function testMethodGetconnectionHasResultLdapConnectionIfConfiguredThatWay() - { - $this->skipIfNoLdap(); - $factory = new Horde_Kolab_Server_Factory_Connection_Configuration( - array('basedn' => 'a') - ); - $this->assertType('Horde_Kolab_Server_Connection_Simpleldap', $factory->getConnection()); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php deleted file mode 100644 index 2657ab7cb..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Prepare the test setup. - */ -require_once dirname(__FILE__) . '/../../../../Autoload.php'; - -/** - * Test the injector based connection 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_Connection_InjectorTest -extends PHPUnit_Framework_TestCase -{ - public function testMethodGetconnectionHasResultConnection() - { - $injector = new Horde_Injector(new Horde_Injector_TopLevel()); - $injector->bindImplementation( - 'Horde_Kolab_Server_Factory_Connection_Interface', - 'Horde_Kolab_Server_Factory_Connection_Mock' - ); - $injector->setInstance( - 'Horde_Kolab_Server_Configuration', - array() - ); - $factory = new Horde_Kolab_Server_Factory_Connection_Injector($injector); - $this->assertType( - 'Horde_Kolab_Server_Connection_Interface', - $factory->getConnection() - ); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php deleted file mode 100644 index ee759c72b..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php +++ /dev/null @@ -1,125 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Require our basic test case definition - */ -require_once dirname(__FILE__) . '/../../../../LdapTestCase.php'; - -/** - * Test the ldap connection 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_Connection_LdapTest -extends Horde_Kolab_Server_LdapTestCase -{ - public function testMethodSetconfigurationHasPostconditionThatTheServerParameterWasRewritten() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Ldap(); - $factory->setConfiguration( - array( - 'basedn' => 'test', - 'server' => '1' - ) - ); - $this->assertEquals( - array( - 'basedn' => 'test', - 'host' => '1' - ), - $factory->getConfiguration() - ); - } - - public function testMethodSetconfigurationHasPostconditionThatThePhpdnParameterWasRewritten() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Ldap(); - $factory->setConfiguration( - array( - 'basedn' => 'test', - 'phpdn' => '1' - ) - ); - $this->assertEquals( - array( - 'basedn' => 'test', - 'binddn' => '1' - ), - $factory->getConfiguration() - ); - } - - public function testMethodSetconfigurationHasPostconditionThatThePhppwParameterWasRewritten() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Ldap(); - $factory->setConfiguration( - array( - 'basedn' => 'test', - 'phppw' => '1' - ) - ); - $this->assertEquals( - array( - 'basedn' => 'test', - 'bindpw' => '1' - ), - $factory->getConfiguration() - ); - } - - public function testMethodSetconfigurationThrowsExceptionIfTheBasednIsNotSet() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Ldap(); - try { - $factory->setConfiguration(array()); - $this->fail('No exception!'); - } catch (Horde_Kolab_Server_Exception $e) { - $this->assertEquals( - 'The base DN is missing!', - $e->getMessage() - ); - } - } - - public function testMethodGetconnectionHasResultConnectionSimpleldap() - { - $this->skipIfNoLdap(); - $factory = new Horde_Kolab_Server_Factory_Connection_Ldap(); - $factory->setConfiguration(array('basedn' => 'test')); - $this->assertType( - 'Horde_Kolab_Server_Connection_Simpleldap', - $factory->getConnection() - ); - } - - public function testMethodGetconnectionHasResultConnectionSplittedldapIfTheHostMasterIsSet() - { - $this->skipIfNoLdap(); - $factory = new Horde_Kolab_Server_Factory_Connection_Ldap(); - $factory->setConfiguration(array('basedn' => 'test', 'host_master' => 'dummy')); - $this->assertType( - 'Horde_Kolab_Server_Connection_Splittedldap', - $factory->getConnection() - ); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php deleted file mode 100644 index eb8dca13a..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Prepare the test setup. - */ -require_once dirname(__FILE__) . '/../../../../Autoload.php'; - -/** - * Test the mock connection 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_Connection_MockTest -extends PHPUnit_Framework_TestCase -{ - public function testMethodGetconfigurationHasResultArrayTheConnectionConfiguration() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Mock(); - $factory->setConfiguration(array('basedn' => 'test')); - $this->assertEquals( - array('basedn' => 'test'), - $factory->getConfiguration() - ); - } - - public function testMethodSetconfigurationHasPostconditionThatTheConfigurationWasSaved() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Mock(); - $factory->setConfiguration(array()); - $this->assertEquals( - array(), - $factory->getConfiguration() - ); - } - - public function testMethodGetconfigurationThrowsExceptionIfNoConfigurationHasBeenSet() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Mock(); - try { - $factory->getConfiguration(); - $this->fail('No exception!'); - } catch (Horde_Kolab_Server_Exception $e) { - $this->assertEquals( - 'The configuration has not been set!', - $e->getMessage() - ); - } - } - - public function testMethodGetconnectionHasResultConnectionmock() - { - $factory = new Horde_Kolab_Server_Factory_Connection_Mock(); - $factory->setConfiguration( - array( - 'basedn' => 'test', - 'data' => array() - ) - ); - $this->assertType( - 'Horde_Kolab_Server_Connection_Mock', - $factory->getConnection() - ); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php deleted file mode 100644 index 092b83418..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php +++ /dev/null @@ -1,170 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Require our basic test case definition - */ -require_once dirname(__FILE__) . '/../../../LdapTestCase.php'; - -/** - * Test the mapping server 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_ConstructorTest -extends Horde_Kolab_Server_LdapTestCase -{ - public function setUp() - { - parent::setUp(); - $this->factory = $this->getMock( - 'Horde_Kolab_Server_Factory_Connection_Interface' - ); - $this->objects = $this->getMock( - 'Horde_Kolab_Server_Objects_Interface' - ); - $this->structure = $this->getMock( - 'Horde_Kolab_Server_Structure_Interface' - ); - $this->search = $this->getMock( - 'Horde_Kolab_Server_Search_Interface' - ); - $this->schema = $this->getMock( - 'Horde_Kolab_Server_Schema_Interface' - ); - } - - public function testMethodConstructHasParametersFactoryObjectsStructureSearchSchemaConfig() - { - $factory = new Horde_Kolab_Server_Factory_Constructor( - $this->factory, $this->objects, $this->structure, - $this->search, $this->schema, array('basedn' => 'test') - ); - } - - public function testMethodGetserverReturnsServer() - { - $this->skipIfNoLdap(); - $this->factory->expects($this->once()) - ->method('getConnection') - ->will( - $this->returnValue( - $this->getMock( - 'Horde_Kolab_Server_Connection_Interface' - ) - ) - ); - $factory = new Horde_Kolab_Server_Factory_Constructor( - $this->factory, $this->objects, $this->structure, - $this->search, $this->schema, array('basedn' => 'test') - ); - $this->assertType('Horde_Kolab_Server_Interface', $factory->getServer()); - } - - public function testMethodGetconfigurationReturnsArrayConfiguration() - { - $factory = new Horde_Kolab_Server_Factory_Constructor( - $this->factory, $this->objects, $this->structure, - $this->search, $this->schema, array('basedn' => 'test') - ); - $this->assertEquals( - array('basedn' => 'test'), $factory->getConfiguration() - ); - } - - public function testMethodGetconnectionGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConnection') - ->will( - $this->returnValue( - $this->getMock('Horde_Kolab_Server_Connection_Interface') - ) - ); - $factory = new Horde_Kolab_Server_Factory_Constructor( - $this->factory, $this->objects, $this->structure, - $this->search, $this->schema, array('basedn' => 'test') - ); - $this->assertType( - 'Horde_Kolab_Server_Connection_Interface', - $factory->getConnection() - ); - } - - public function testMethodGetcompositeReturnsComposite() - { - $this->skipIfNoLdap(); - $this->factory->expects($this->once()) - ->method('getConnection') - ->will( - $this->returnValue( - $this->getMock( - 'Horde_Kolab_Server_Connection_Interface' - ) - ) - ); - $factory = new Horde_Kolab_Server_Factory_Constructor( - $this->factory, $this->objects, $this->structure, - $this->search, $this->schema, array('basedn' => 'test') - ); - $this->assertType( - 'Horde_Kolab_Server_Composite', - $factory->getComposite() - ); - } - - public function testMethodGetobjectsReturnsObjects() - { - $factory = new Horde_Kolab_Server_Factory_Constructor( - $this->factory, $this->objects, $this->structure, - $this->search, $this->schema, array('basedn' => 'test') - ); - $this->assertSame($this->objects, $factory->getObjects()); - } - - public function testMethodGetstructureReturnsStructure() - { - $factory = new Horde_Kolab_Server_Factory_Constructor( - $this->factory, $this->objects, $this->structure, - $this->search, $this->schema, array('basedn' => 'test') - ); - $this->assertSame($this->structure, $factory->getStructure()); - } - - public function testMethodGetsearchReturnsSearch() - { - $factory = new Horde_Kolab_Server_Factory_Constructor( - $this->factory, $this->objects, $this->structure, - $this->search, $this->schema, array('basedn' => 'test') - ); - $this->assertSame($this->search, $factory->getSearch()); - } - - public function testMethodGetschemaGetsDelegated() - { - $factory = new Horde_Kolab_Server_Factory_Constructor( - $this->factory, $this->objects, $this->structure, - $this->search, $this->schema, array('basedn' => 'test') - ); - $this->assertSame($this->schema, $factory->getSchema()); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CleanTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CleanTest.php deleted file mode 100644 index 2282119a1..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CleanTest.php +++ /dev/null @@ -1,166 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Prepare the test setup. - */ -require_once dirname(__FILE__) . '/../../../../Autoload.php'; - -/** - * Test the cleaner server 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_Decorator_CleanTest -extends PHPUnit_Framework_TestCase -{ - public function setUp() - { - $this->factory = $this->getMock( - 'Horde_Kolab_Server_Factory_Interface' - ); - } - - public function testMethodGetserverHasResultCleanerServerIfACleanedWasProvidedInTheConfiguration() - { - $this->factory->expects($this->once()) - ->method('getServer') - ->will( - $this->returnValue( - $this->getMock( - 'Horde_Kolab_Server_Interface' - ) - ) - ); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array('cleanup' => true) - ); - $this->assertType( - 'Horde_Kolab_Server_Decorator_Clean', - $factory->getServer() - ); - } - - public function testMethodConstructHasParametersFactory() - { - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory - ); - } - - public function testMethodGetconnectionfactoryGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConnectionFactory'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array() - ); - $factory->getConnectionFactory(); - } - - public function testMethodGetserverGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getServer') - ->will( - $this->returnValue( - $this->getMock( - 'Horde_Kolab_Server_Interface' - ) - ) - ); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array() - ); - $factory->getServer(); - } - - public function testMethodGetconfigurationGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConfiguration'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array() - ); - $factory->getConfiguration(); - } - - public function testMethodGetconnectionGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConnection'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array() - ); - $factory->getConnection(); - } - - public function testMethodGetcompositeGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getComposite'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array() - ); - $factory->getComposite(); - } - - public function testMethodGetobjectsGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getObjects'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array() - ); - $factory->getObjects(); - } - - public function testMethodGetstructureGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getStructure'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array() - ); - $factory->getStructure(); - } - - public function testMethodGetsearchGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getSearch'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array() - ); - $factory->getSearch(); - } - - public function testMethodGetschemaGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getSchema'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Clean( - $this->factory, array() - ); - $factory->getSchema(); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CountTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CountTest.php deleted file mode 100644 index c2212b08b..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CountTest.php +++ /dev/null @@ -1,163 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Prepare the test setup. - */ -require_once dirname(__FILE__) . '/../../../../Autoload.php'; - -/** - * Test the count decorator server 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_Decorator_CountTest -extends PHPUnit_Framework_TestCase -{ - public function setUp() - { - $this->factory = $this->getMock( - 'Horde_Kolab_Server_Factory_Interface' - ); - } - - public function testMethodGetserverHasResultCountedServer() - { - $this->factory->expects($this->once()) - ->method('getServer') - ->will( - $this->returnValue( - $this->getMock( - 'Horde_Kolab_Server_Interface' - ) - ) - ); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $this->assertType('Horde_Kolab_Server_Decorator_Count', $factory->getServer()); - } - - public function testMethodConstructHasParametersFactoryAndMixedLoggerParameter() - { - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - } - - public function testMethodGetconnectionfactoryHasPostconditionThatTheCallWasDelegated() - { - $this->factory->expects($this->once()) - ->method('getConnectionFactory'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $factory->getConnectionFactory(); - } - - public function testMethodGetserverHasPostconditionThatTheCallWasDelegated() - { - $this->factory->expects($this->once()) - ->method('getServer') - ->will( - $this->returnValue( - $this->getMock( - 'Horde_Kolab_Server_Interface' - ) - ) - ); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $factory->getServer(); - } - - public function testMethodGetconfigurationHasPostconditionThatTheCallWasDelegated() - { - $this->factory->expects($this->once()) - ->method('getConfiguration'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $factory->getConfiguration(); - } - - public function testMethodGetconnectionHasPostconditionThatTheCallWasDelegated() - { - $this->factory->expects($this->once()) - ->method('getConnection'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $factory->getConnection(); - } - - public function testMethodGetcompositeHasPostconditionThatTheCallWasDelegated() - { - $this->factory->expects($this->once()) - ->method('getComposite'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $factory->getComposite(); - } - - public function testMethodGetobjectsHasPostconditionThatTheCallWasDelegated() - { - $this->factory->expects($this->once()) - ->method('getObjects'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $factory->getObjects(); - } - - public function testMethodGetstructureHasPostconditionThatTheCallWasDelegated() - { - $this->factory->expects($this->once()) - ->method('getStructure'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $factory->getStructure(); - } - - public function testMethodGetsearchHasPostconditionThatTheCallWasDelegated() - { - $this->factory->expects($this->once()) - ->method('getSearch'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $factory->getSearch(); - } - - public function testMethodGetschemaHasPostconditionThatTheCallWasDelegated() - { - $this->factory->expects($this->once()) - ->method('getSchema'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Count( - $this->factory, 'logger' - ); - $factory->getSchema(); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/LogTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/LogTest.php deleted file mode 100644 index 696aa63c0..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/LogTest.php +++ /dev/null @@ -1,163 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Prepare the test setup. - */ -require_once dirname(__FILE__) . '/../../../../Autoload.php'; - -/** - * Test the log decorator server 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_Decorator_LogTest -extends PHPUnit_Framework_TestCase -{ - public function setUp() - { - $this->factory = $this->getMock( - 'Horde_Kolab_Server_Factory_Interface' - ); - } - - public function testMethodGetserverHasResultLoggedServerIfALoggerWasProvidedInTheConfiguration() - { - $this->factory->expects($this->once()) - ->method('getServer') - ->will( - $this->returnValue( - $this->getMock( - 'Horde_Kolab_Server_Interface' - ) - ) - ); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $this->assertType('Horde_Kolab_Server_Decorator_Log', $factory->getServer()); - } - - public function testMethodConstructHasParametersFactoryAndMixedLoggerParameter() - { - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - } - - public function testMethodGetconnectionfactoryGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConnectionFactory'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $factory->getConnectionFactory(); - } - - public function testMethodGetserverGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getServer') - ->will( - $this->returnValue( - $this->getMock( - 'Horde_Kolab_Server_Interface' - ) - ) - ); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $factory->getServer(); - } - - public function testMethodGetconfigurationGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConfiguration'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $factory->getConfiguration(); - } - - public function testMethodGetconnectionGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConnection'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $factory->getConnection(); - } - - public function testMethodGetcompositeGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getComposite'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $factory->getComposite(); - } - - public function testMethodGetobjectsGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getObjects'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $factory->getObjects(); - } - - public function testMethodGetstructureGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getStructure'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $factory->getStructure(); - } - - public function testMethodGetsearchGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getSearch'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $factory->getSearch(); - } - - public function testMethodGetschemaGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getSchema'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Log( - $this->factory, 'logger' - ); - $factory->getSchema(); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/MapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/MapTest.php deleted file mode 100644 index 8ccbc6f36..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/Decorator/MapTest.php +++ /dev/null @@ -1,164 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Prepare the test setup. - */ -require_once dirname(__FILE__) . '/../../../../Autoload.php'; - -/** - * Test the mapping server 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_Decorator_MapTest -extends PHPUnit_Framework_TestCase -{ - public function setUp() - { - $this->factory = $this->getMock( - 'Horde_Kolab_Server_Factory_Interface' - ); - } - - public function testMethodGetserverHasResultMappedServer() - { - $this->factory->expects($this->once()) - ->method('getServer') - ->will( - $this->returnValue( - $this->getMock('Horde_Kolab_Server_Interface') - ) - ); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $this->assertType( - 'Horde_Kolab_Server_Decorator_Map', - $factory->getServer() - ); - } - - public function testMethodConstructHasParametersFactoryAndArrayMapping() - { - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - } - - public function testMethodGetconnectionfactoryGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConnectionFactory'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $factory->getConnectionFactory(); - } - - public function testMethodGetserverGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getServer') - ->will( - $this->returnValue( - $this->getMock( - 'Horde_Kolab_Server_Interface' - ) - ) - ); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $factory->getServer(); - } - - public function testMethodGetconfigurationGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConfiguration'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $factory->getConfiguration(); - } - - public function testMethodGetconnectionGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getConnection'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $factory->getConnection(); - } - - public function testMethodGetcompositeGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getComposite'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $factory->getComposite(); - } - - public function testMethodGetobjectsGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getObjects'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $factory->getObjects(); - } - - public function testMethodGetstructureGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getStructure'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $factory->getStructure(); - } - - public function testMethodGetsearchGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getSearch'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $factory->getSearch(); - } - - public function testMethodGetschemaGetsDelegated() - { - $this->factory->expects($this->once()) - ->method('getSchema'); - $factory = new Horde_Kolab_Server_Factory_Decorator_Map( - $this->factory, array() - ); - $factory->getSchema(); - } -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/InjectorTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/InjectorTest.php deleted file mode 100644 index 41cb69e97..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/InjectorTest.php +++ /dev/null @@ -1,161 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Require our basic test case definition - */ -require_once dirname(__FILE__) . '/../../../LdapTestCase.php'; - -/** - * Test the injector based server 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_InjectorTest -extends Horde_Kolab_Server_LdapTestCase -{ - private function _getFactory(array $configuration = array()) - { - $injector = new Horde_Injector(new Horde_Injector_TopLevel()); - Horde_Kolab_Server_Factory_Injector::setup( - 'Horde_Kolab_Server_Factory_Connection_Mock', - $configuration, - $injector - ); - return $injector->getInstance( - 'Horde_Kolab_Server_Factory_Injector' - ); - } - - public function testMethodGetconnectionfactoryHasResultConnectionfactory() - { - $this->assertType( - 'Horde_Kolab_Server_Factory_Connection_Interface', - $this->_getFactory(array())->getConnectionFactory() - ); - } - - public function testMethodGetconnectionHasResultConnection() - { - $factory = $this->_getFactory(array()); - $this->assertType( - 'Horde_Kolab_Server_Connection_Interface', - $factory->getConnection() - ); - } - - public function testMethodGetserverHasResultServerldapstandard() - { - $this->skipIfNoLdap(); - $factory = $this->_getFactory(array('basedn' => 'test')); - $this->assertType( - 'Horde_Kolab_Server_Ldap_Standard', - $factory->getServer() - ); - } - - public function testMethodGetserverThrowsExceptionIfTheBaseDnIsMissingInTheConfiguration() - { - $factory = $this->_getFactory(array()); - try { - $factory->getServer(); - $this->fail('No exception!'); - } catch (Horde_Kolab_Server_Exception $e) { - $this->assertEquals( - 'The base DN is missing!', - $e->getMessage() - ); - } - } - - public function testMethodGetserverHasResultServerldapFilteredIfAFilterWasSet() - { - $this->skipIfNoLdap(); - $factory = $this->_getFactory(array('filter' => 'test', 'basedn' => 'test')); - $this->assertType( - 'Horde_Kolab_Server_Ldap_Filtered', - $factory->getServer() - ); - } - - public function testMethodGetobjectsHasResultObjects() - { - $factory = $this->_getFactory(array()); - $this->assertType( - 'Horde_Kolab_Server_Objects_Interface', - $factory->getObjects() - ); - } - - public function testMethodGetstructureHasResultStructureKolab() - { - $factory = $this->_getFactory(array()); - $this->assertType( - 'Horde_Kolab_Server_Structure_Kolab', - $factory->getStructure() - ); - } - - public function testMethodGetstructureHasResultStructureLdapIfConfiguredThatWay() - { - $factory = $this->_getFactory( - array( - 'structure' => array( - 'driver' => 'Horde_Kolab_Server_Structure_Ldap' - ) - ) - ); - $this->assertType( - 'Horde_Kolab_Server_Structure_Ldap', - $factory->getStructure() - ); - } - - public function testMethodGetsearchHasResultSearch() - { - $factory = $this->_getFactory(array()); - $this->assertType( - 'Horde_Kolab_Server_Search_Interface', - $factory->getSearch() - ); - } - - public function testMethodGetschemaHasResultSchema() - { - $factory = $this->_getFactory(array()); - $this->assertType( - 'Horde_Kolab_Server_Schema_Interface', - $factory->getSchema() - ); - } - - public function testMethodGetcompositeHasResultComposite() - { - $this->skipIfNoLdap(); - $factory = $this->_getFactory(array('basedn' => 'test')); - $this->assertType( - 'Horde_Kolab_Server_Composite', - $factory->getComposite() - ); - } - -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/KolabTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/KolabTest.php deleted file mode 100644 index 5b4bf0a6c..000000000 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/KolabTest.php +++ /dev/null @@ -1,189 +0,0 @@ - - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ - -/** - * Require our basic test case definition - */ -require_once dirname(__FILE__) . '/../../../LdapTestCase.php'; - -/** - * Test the default Kolab server 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_Server - * @author Gunnar Wrobel - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @link http://pear.horde.org/index.php?package=Kolab_Server - */ -class Horde_Kolab_Server_Class_Server_Factory_KolabTest -extends Horde_Kolab_Server_LdapTestCase -{ - public function setUp() - { - $this->conn_factory = $this->getMock( - 'Horde_Kolab_Server_Factory_Connection_Interface' - ); - $this->connection = $this->getMock( - 'Horde_Kolab_Server_Connection_Interface' - ); - } - - public function testMethodConstructHasParametersConnectionfactoryAndArrayParameters() - { - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array() - ); - } - - public function testMethodGetconnectionfactoryHasResultTheStoredConnectionfactory() - { - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array() - ); - $this->assertSame($this->conn_factory, $factory->getConnectionFactory()); - } - - public function testMethodGetconfigurationHasResultTheStoredConfigurationParameters() - { - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array('a' => 'a') - ); - $this->assertEquals(array('a' => 'a'), $factory->getConfiguration()); - } - - public function testMethodGetconnectionHasResultConnection() - { - $this->conn_factory->expects($this->once()) - ->method('setConfiguration') - ->with(array()); - $this->conn_factory->expects($this->once()) - ->method('getConnection') - ->will($this->returnValue($this->connection)); - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array() - ); - $this->assertType( - 'Horde_Kolab_Server_Connection_Interface', - $factory->getConnection() - ); - } - - public function testMethodGetobjectsHasResultObjectsbase() - { - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array() - ); - $this->assertType( - 'Horde_Kolab_Server_Objects_Base', - $factory->getObjects() - ); - } - - public function testMethodGetsearchHasResultSearchbase() - { - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array() - ); - $this->assertType( - 'Horde_Kolab_Server_Search_Base', - $factory->getSearch() - ); - } - - public function testMethodGetsearchHasResultSchemabase() - { - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array() - ); - $this->assertType( - 'Horde_Kolab_Server_Schema_Base', - $factory->getSchema() - ); - } - - public function testMethodGetstructureHasResultStructurekolab() - { - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array() - ); - $this->assertType( - 'Horde_Kolab_Server_Structure_Kolab', - $factory->getStructure() - ); - } - - public function testMethodGetserverHasResultServerldapstandard() - { - $this->skipIfNoLdap(); - $this->conn_factory->expects($this->once()) - ->method('getConnection') - ->will($this->returnValue($this->connection)); - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array('basedn' => 'test') - ); - $this->assertType( - 'Horde_Kolab_Server_Ldap_Standard', - $factory->getServer() - ); - } - - public function testMethodGetserverHasResultServerldapfilteredIfTheFilterOptionIsSet() - { - $this->skipIfNoLdap(); - $this->conn_factory->expects($this->once()) - ->method('getConnection') - ->will($this->returnValue($this->connection)); - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array('basedn' => 'test', 'filter' => 'a') - ); - $this->assertType( - 'Horde_Kolab_Server_Ldap_Filtered', - $factory->getServer() - ); - } - - public function testMethodGetserverThrowsExceptionIfTheBasednIsMissingInTheConfiguration() - { - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array() - ); - try { - $factory->getServer(); - $this->fail('No exception!'); - } catch (Horde_Kolab_Server_Exception $e) { - $this->assertEquals('The base DN is missing', $e->getMessage()); - } - } - - public function testMethodGetcompositeHasResultComposite() - { - $this->skipIfNoLdap(); - $this->conn_factory->expects($this->once()) - ->method('getConnection') - ->will($this->returnValue($this->connection)); - $factory = new Horde_Kolab_Server_Factory_Kolab( - $this->conn_factory, array('basedn' => 'test') - ); - $this->assertType( - 'Horde_Kolab_Server_Composite', - $factory->getComposite() - ); - } - - -} \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/SearchguidforuidormailTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/SearchguidforuidormailTest.php index 5506693ca..ad5d13899 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/SearchguidforuidormailTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/SearchguidforuidormailTest.php @@ -35,23 +35,32 @@ extends Horde_Kolab_Server_LdapTestCase { public function setUp() { - $conf['basedn'] = 'dc=test'; - $conf['mock'] = true; - $conf['data'] = array( - 'dn=user,dc=test' => array( - 'dn' => 'dn=user,dc=test', - 'data' => array( - 'uid' => array('user'), - 'mail' => array('user@example.org'), - 'objectClass' => array('top', 'kolabInetOrgPerson'), + $connection = new Horde_Kolab_Server_Connection_Mock( + new Horde_Kolab_Server_Connection_Mock_Ldap( + array('basedn' => 'dc=test'), + array( + 'dn=user,dc=test' => array( + 'dn' => 'dn=user,dc=test', + 'data' => array( + 'uid' => array('user'), + 'mail' => array('user@example.org'), + 'objectClass' => array('top', 'kolabInetOrgPerson'), + ) + ) ) ) ); - $server_factory = new Horde_Kolab_Server_Factory_Configuration( - $conf - ); - $this->composite = $server_factory->getComposite(); + $this->composite = new Horde_Kolab_Server_Composite( + new Horde_Kolab_Server_Ldap_Standard( + $connection, + 'dc=test' + ), + new Horde_Kolab_Server_Objects_Base(), + new Horde_Kolab_Server_Structure_Kolab(), + new Horde_Kolab_Server_Search_Base(), + new Horde_Kolab_Server_Schema_Base() + ); $this->composite->server->connectGuid(); } diff --git a/framework/Share/Share/kolab.php b/framework/Share/Share/kolab.php index 05604f0c7..37eb9c858 100644 --- a/framework/Share/Share/kolab.php +++ b/framework/Share/Share/kolab.php @@ -88,7 +88,7 @@ class Horde_Share_kolab extends Horde_Share { public function getSession() { if (!isset($this->_session)) { - $this->_session = Horde_Kolab_Session_Singleton::singleton(); + $this->_session = $GLOBALS['injector']->getInstance('Horde_Kolab_Session'); } return $this->_session; } @@ -470,7 +470,7 @@ class Horde_Share_Object_kolab extends Horde_Share_Object { public function getSession() { if (!isset($this->_session)) { - $this->_session = Horde_Kolab_Session_Singleton::singleton(); + $this->_session = $GLOBALS['injector']->getInstance('Horde_Kolab_Session'); } return $this->_session; } -- 2.11.0