--- /dev/null
+<?php
+/**
+ * A factory for Kolab server objects.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Core
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+
+/**
+ * A factory for Kolab server objects.
+ *
+ * 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 Horde
+ * @package Core
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+class Horde_Core_Factory_KolabServer
+{
+ /**
+ * The injector.
+ *
+ * @var Horde_Injector
+ */
+ private $_injector;
+
+ /**
+ * Constructor.
+ *
+ * @param Horde_Injector $injector The injector to use.
+ */
+ public function __construct(
+ Horde_Injector $injector
+ ) {
+ $this->_injector = $injector;
+ $this->_setup();
+ }
+
+ /**
+ * Setup the machinery to create Horde_Kolab_Server objects.
+ *
+ * @return NULL
+ */
+ private function _setup()
+ {
+ $this->_setupConfiguration();
+ $this->_setupConnection();
+ $this->_setupObjects();
+ $this->_setupSearch();
+ $this->_setupSchema();
+ $this->_setupStructure();
+ $this->_setupServer();
+ }
+
+ /**
+ * Inject the server configuration.
+ *
+ * @return NULL
+ */
+ private function _setupConfiguration()
+ {
+ $configuration = array();
+
+ //@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 a Horde_Kolab_Server_Connection.
+ *
+ * @return NULL
+ */
+ private function _setupConnection()
+ {
+ $this->_injector->bindFactory(
+ 'Horde_Kolab_Server_Connection',
+ 'Horde_Core_Factory_KolabServer',
+ 'getConnection'
+ );
+ }
+
+ /**
+ * Setup the machinery to create a Horde_Kolab_Server_Objects handler.
+ *
+ * @return NULL
+ */
+ private function _setupObjects()
+ {
+ $this->_injector->bindImplementation(
+ 'Horde_Kolab_Server_Objects_Interface',
+ 'Horde_Kolab_Server_Objects_Base'
+ );
+ }
+
+ /**
+ * Setup the machinery to create a Horde_Kolab_Server_Search handler.
+ *
+ * @return NULL
+ */
+ private function _setupSearch()
+ {
+ $this->_injector->bindImplementation(
+ 'Horde_Kolab_Server_Search_Interface',
+ 'Horde_Kolab_Server_Search_Base'
+ );
+ }
+
+ /**
+ * Setup the machinery to create a Horde_Kolab_Server_Schema handler.
+ *
+ * @return NULL
+ */
+ private function _setupSchema()
+ {
+ $this->_injector->bindImplementation(
+ 'Horde_Kolab_Server_Schema_Interface',
+ 'Horde_Kolab_Server_Schema_Base'
+ );
+ }
+
+ /**
+ * Setup the machinery to create a Horde_Kolab_Server_Structure handler.
+ *
+ * @return NULL
+ */
+ private function _setupStructure()
+ {
+ $configuration = $this->getConfiguration();
+ if (!isset($configuration['structure']['driver'])) {
+ $driver = 'Horde_Kolab_Server_Structure_Kolab';
+ } else {
+ $driver = $configuration['structure']['driver'];
+ }
+
+ $this->_injector->bindImplementation(
+ 'Horde_Kolab_Server_Structure_Interface', $driver
+ );
+ }
+
+ /**
+ * Setup the machinery to create a Horde_Kolab_Server.
+ *
+ * @return NULL
+ */
+ private function _setupServer()
+ {
+ $this->_injector->bindFactory(
+ 'Horde_Kolab_Server_Interface',
+ 'Horde_Core_Factory_KolabServer',
+ 'getServer'
+ );
+ }
+
+ /**
+ * Return the conn server connection that should be used.
+ *
+ * @return Horde_Kolab_Server The Horde_Kolab_Server connection.
+ */
+ public function getConnection()
+ {
+ $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;
+ }
+ }
+
+ /**
+ * Returns the server configuration parameters.
+ *
+ * @return array The configuration parameters.
+ */
+ public function getConfiguration()
+ {
+ return $this->_injector->getInstance('Horde_Kolab_Server_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_Exception('The parameter \'basedn\' is missing in the Kolab server configuration!');
+ }
+
+ $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']
+ );
+ }
+
+ 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;
+ }
+
+ /**
+ * 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->_injector->getInstance(
+ 'Horde_Kolab_Server_Objects_Interface'
+ );
+ }
+
+ /**
+ * Return the structural representation that should be used.
+ *
+ * @return Horde_Kolab_Server_Structure The representation of the db
+ * structure.
+ */
+ public function getStructure()
+ {
+ return $this->_injector->getInstance(
+ 'Horde_Kolab_Server_Structure_Interface'
+ );
+ }
+
+ /**
+ * Return the search handler that should be used.
+ *
+ * @return Horde_Kolab_Server_Search The search handler.
+ */
+ public function getSearch()
+ {
+ return $this->_injector->getInstance(
+ 'Horde_Kolab_Server_Search_Interface'
+ );
+ }
+
+ /**
+ * Return the db schema representation that should be used.
+ *
+ * @return Horde_Kolab_Server_Schema The db schema representation.
+ */
+ public function getSchema()
+ {
+ return $this->_injector->getInstance(
+ 'Horde_Kolab_Server_Schema_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()
+ {
+ return new Horde_Kolab_Server_Composite(
+ $this->getServer(),
+ $this->getObjects(),
+ $this->getStructure(),
+ $this->getSearch(),
+ $this->getSchema()
+ );
+ }
+}
\ No newline at end of file
$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);
<file name="Perms.php" role="php" />
<file name="Template.php" role="php" />
</dir> <!-- /lib/Horde/Core/Binder -->
+ <dir name="Factory">
+ <file name="KolabServer.php" role="php" />
+ </dir> <!-- /lib/Horde/Core/Factory -->
<dir name="Notification">
<file name="Status.php" role="php" />
</dir> <!-- /lib/Horde/Core/Notification -->
<dir name="test">
<dir name="Horde">
<dir name="Core">
+ <file name="AllTests.php" role="test" />
+ <file name="Autoload.php" role="test" />
+ <dir name="Factory">
+ <file name="KolabServerTest.php" role="test" />
+ </dir> <!-- /test/Horde/Core/Factory -->
+ <file name="phpunit.xml" role="test" />
<file name="url.phpt" role="test" />
</dir> <!-- /test/Horde/Core -->
</dir> <!-- /test/Horde -->
<install name="lib/Horde/Core/Binder/Notification.php" as="Horde/Core/Binder/Notification.php" />
<install name="lib/Horde/Core/Binder/Perms.php" as="Horde/Core/Binder/Perms.php" />
<install name="lib/Horde/Core/Binder/Template.php" as="Horde/Core/Binder/Template.php" />
+ <install name="lib/Horde/Core/Factory/KolabServer.php" as="Horde/Core/Factory/KolabServer.php" />
<install name="lib/Horde/Core/Notification/Status.php" as="Horde/Core/Notification/Status.php" />
<install name="lib/Horde/ErrorHandler.php" as="Horde/ErrorHandler.php" />
<install name="lib/Horde/Exception/HookNotSet.php" as="Horde/Exception/HookNotSet.php" />
<install name="lib/Horde/Themes/Image.php" as="Horde/Themes/Image.php" />
<install name="lib/Horde/Themes/Sound.php" as="Horde/Themes/Sound.php" />
<install name="lib/Horde.php" as="Horde.php" />
+ <install name="test/Horde/Core/AllTests.php" as="Horde/Core/AllTests.php" />
+ <install name="test/Horde/Core/Autoload.php" as="Horde/Core/Autoload.php" />
+ <install name="test/Horde/Core/Factory/KolabServerTest.php" as="Horde/Core/Factory/KolabServerTest.php" />
</filelist>
</phprelease>
<changelog>
--- /dev/null
+<?php
+/**
+ * All tests for the Horde_Core:: package.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Core
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+
+/**
+ * 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();
+}
--- /dev/null
+<?php
+/**
+ * Setup autoloading for the tests.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Core
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+
+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);
--- /dev/null
+<?php
+/**
+ * Test the Kolab_Server factory.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package Core
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+
+/**
+ * Require our basic test case definition
+ */
+require_once dirname(__FILE__) . '/../Autoload.php';
+
+/**
+ * Test the Kolab_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 <wrobel@pardus.de>
+ * @license http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link http://pear.horde.org/index.php?package=Core
+ */
+class Horde_Core_Factory_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
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit>
+ <filter>
+ <whitelist>
+ <directory suffix=".php">../../../lib</directory>
+ </whitelist>
+ </filter>
+</phpunit>
+++ /dev/null
-<?php
-/**
- * Basic server factory functionality.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A factory that receives all required details via configuration parameters.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A base connection factory definition.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A factory that receives all required details via configuration parameters.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A factory that generates connections using the Horde_Injector.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * The interface of Kolab server connection factories.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A factory that generates LDAP connections.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A factory that generates mock connections.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A Kolab server factory that receives all required details via the
- * factory constructor.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A factory decorator that adds cleaning to the generated instances.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A factory decorator that adds counting to the generated instances.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A factory decorator that adds logging to the generated instances.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A factory decorator that adds mapping to the generated instances.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A Kolab server factory providing defaults where applicable.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A library for accessing the Kolab user database.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Kolab_Server
- */
-
-/**
- * A factory for Kolab server objects.
- *
- * 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 <wrobel@pardus.de>
- * @license http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link http://pear.horde.org/index.php?package=Kolab_Server
- */
-class Horde_Kolab_Server_Factory_Injector
-implements Horde_Kolab_Server_Factory_Interface
-{
- /**
- * The injector.
- *
- * @var Horde_Injector
- */
- private $_injector;
-
- /**
- * Constructor.
- *
- * @param Horde_Injector $injector The injector to use.
- */
- public function __construct(
- Horde_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.
- *
- * @return NULL
- */
- static public function setup(
- $factory,
- array $config,
- Horde_Injector $injector
- ) {
- self::_setupConfiguration($config, $injector);
- self::_setupConnectionFactory($factory, $injector);
- }
-
- /**
- * 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
- );
- }
-
- /**
- * 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
- );
- }
-
- /**
- * Setup the machinery to create Horde_Kolab_Server objects.
- *
- * @return NULL
- */
- private function _setup()
- {
- $this->_setupObjects();
- $this->_setupSearch();
- $this->_setupSchema();
- $this->_setupStructure();
- $this->_setupConnection();
- $this->_setupServer();
- }
-
- /**
- * Setup the machinery to create a Horde_Kolab_Server_Objects handler.
- *
- * @return NULL
- */
- private function _setupObjects()
- {
- $this->_injector->bindImplementation(
- 'Horde_Kolab_Server_Objects_Interface',
- 'Horde_Kolab_Server_Objects_Base'
- );
- }
-
- /**
- * Setup the machinery to create a Horde_Kolab_Server_Search handler.
- *
- * @return NULL
- */
- private function _setupSearch()
- {
- $this->_injector->bindImplementation(
- 'Horde_Kolab_Server_Search_Interface',
- 'Horde_Kolab_Server_Search_Base'
- );
- }
-
- /**
- * Setup the machinery to create a Horde_Kolab_Server_Schema handler.
- *
- * @return NULL
- */
- private function _setupSchema()
- {
- $this->_injector->bindImplementation(
- 'Horde_Kolab_Server_Schema_Interface',
- 'Horde_Kolab_Server_Schema_Base'
- );
- }
-
- /**
- * Setup the machinery to create a Horde_Kolab_Server_Structure handler.
- *
- * @return NULL
- */
- private function _setupStructure()
- {
- $configuration = $this->getConfiguration();
- if (!isset($configuration['structure']['driver'])) {
- $driver = 'Horde_Kolab_Server_Structure_Kolab';
- } else {
- $driver = $configuration['structure']['driver'];
- }
-
- $this->_injector->bindImplementation(
- 'Horde_Kolab_Server_Structure_Interface', $driver
- );
- }
-
- /**
- * Setup the machinery to create a Horde_Kolab_Server.
- *
- * @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',
- 'getServer'
- );
- }
-
- /**
- * Return the conn server connection that should be used.
- *
- * @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'
- );
- }
-
- /**
- * Returns the server configuration parameters.
- *
- * @return array The configuration parameters.
- */
- public function getConfiguration()
- {
- return $this->_injector->getInstance('Horde_Kolab_Server_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 object handler that should be used.
- *
- * @return Horde_Kolab_Server_Objects The handler for objects on the server.
- */
- public function getObjects()
- {
- return $this->_injector->getInstance(
- 'Horde_Kolab_Server_Objects_Interface'
- );
- }
-
- /**
- * Return the structural representation that should be used.
- *
- * @return Horde_Kolab_Server_Structure The representation of the db
- * structure.
- */
- public function getStructure()
- {
- return $this->_injector->getInstance(
- 'Horde_Kolab_Server_Structure_Interface'
- );
- }
-
- /**
- * Return the search handler that should be used.
- *
- * @return Horde_Kolab_Server_Search The search handler.
- */
- public function getSearch()
- {
- return $this->_injector->getInstance(
- 'Horde_Kolab_Server_Search_Interface'
- );
- }
-
- /**
- * Return the db schema representation that should be used.
- *
- * @return Horde_Kolab_Server_Schema The db schema representation.
- */
- public function getSchema()
- {
- return $this->_injector->getInstance(
- 'Horde_Kolab_Server_Schema_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()
- {
- return $this->_injector->getInstance(
- 'Horde_Kolab_Server_Composite'
- );
- }
-}
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * The interface of Kolab server factories.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * A Kolab server factory providing the Kolab default.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
<file name="Bindfailed.php" role="php" />
<file name="Novalue.php" role="php" />
</dir> <!-- /lib/Horde/Kolab/Server/Exception -->
- <dir name="Factory">
- <dir name="Connection">
- <file name="Base.php" role="php" />
- <file name="Configuration.php" role="php" />
- <file name="Injector.php" role="php" />
- <file name="Interface.php" role="php" />
- <file name="Ldap.php" role="php" />
- <file name="Mock.php" role="php" />
- </dir> <!-- /lib/Horde/Kolab/Server/Factory/Connection -->
- <dir name="Decorator">
- <file name="Clean.php" role="php" />
- <file name="Count.php" role="php" />
- <file name="Log.php" role="php" />
- <file name="Map.php" role="php" />
- </dir> <!-- /lib/Horde/Kolab/Server/Factory/Decorator -->
- <file name="Base.php" role="php" />
- <file name="Configuration.php" role="php" />
- <file name="Constructor.php" role="php" />
- <file name="Default.php" role="php" />
- <file name="Injector.php" role="php" />
- <file name="Interface.php" role="php" />
- <file name="Kolab.php" role="php" />
- </dir> <!-- /lib/Horde/Kolab/Server/Factory -->
<dir name="Ldap">
<file name="Changes.php" role="php" />
<file name="Filtered.php" role="php" />
<file name="CleanTest.php" role="test" />
<file name="LogTest.php" role="test" />
</dir> <!-- /test/Horde/Kolab/Server/Class/Server/Decorator -->
- <dir name="Factory">
- <dir name="Connection">
- <file name="ConfigurationTest.php" role="test" />
- <file name="InjectorTest.php" role="test" />
- <file name="LdapTest.php" role="test" />
- <file name="MockTest.php" role="test" />
- </dir> <!-- /test/Horde/Kolab/Server/Class/Server/Factory/Connection -->
- <dir name="Decorator">
- <file name="CleanTest.php" role="test" />
- <file name="CountTest.php" role="test" />
- <file name="LogTest.php" role="test" />
- <file name="MapTest.php" role="test" />
- </dir> <!-- /test/Horde/Kolab/Server/Class/Server/Factory/Decorator -->
- <file name="ConfigurationTest.php" role="test" />
- <file name="ConstructorTest.php" role="test" />
- <file name="InjectorTest.php" role="test" />
- <file name="KolabTest.php" role="test" />
- </dir> <!-- /test/Horde/Kolab/Server/Class/Server/Factory -->
<dir name="Ldap">
<file name="ChangesTest.php" role="test" />
<file name="FilteredTest.php" role="test" />
<install as="Horde/Kolab/Server/Decorator/Map.php" name="lib/Horde/Kolab/Server/Decorator/Map.php" />
<install as="Horde/Kolab/Server/Exception/Bindfailed.php" name="lib/Horde/Kolab/Server/Exception/Bindfailed.php" />
<install as="Horde/Kolab/Server/Exception/Novalue.php" name="lib/Horde/Kolab/Server/Exception/Novalue.php" />
- <install as="Horde/Kolab/Server/Factory/Base.php" name="lib/Horde/Kolab/Server/Factory/Base.php" />
- <install as="Horde/Kolab/Server/Factory/Configuration.php" name="lib/Horde/Kolab/Server/Factory/Configuration.php" />
- <install as="Horde/Kolab/Server/Factory/Constructor.php" name="lib/Horde/Kolab/Server/Factory/Constructor.php" />
- <install as="Horde/Kolab/Server/Factory/Default.php" name="lib/Horde/Kolab/Server/Factory/Default.php" />
- <install as="Horde/Kolab/Server/Factory/Injector.php" name="lib/Horde/Kolab/Server/Factory/Injector.php" />
- <install as="Horde/Kolab/Server/Factory/Interface.php" name="lib/Horde/Kolab/Server/Factory/Interface.php" />
- <install as="Horde/Kolab/Server/Factory/Kolab.php" name="lib/Horde/Kolab/Server/Factory/Kolab.php" />
- <install as="Horde/Kolab/Server/Factory/Connection/Base.php" name="lib/Horde/Kolab/Server/Factory/Connection/Base.php" />
- <install as="Horde/Kolab/Server/Factory/Connection/Configuration.php" name="lib/Horde/Kolab/Server/Factory/Connection/Configuration.php" />
- <install as="Horde/Kolab/Server/Factory/Connection/Injector.php" name="lib/Horde/Kolab/Server/Factory/Connection/Injector.php" />
- <install as="Horde/Kolab/Server/Factory/Connection/Interface.php" name="lib/Horde/Kolab/Server/Factory/Connection/Interface.php" />
- <install as="Horde/Kolab/Server/Factory/Connection/Ldap.php" name="lib/Horde/Kolab/Server/Factory/Connection/Ldap.php" />
- <install as="Horde/Kolab/Server/Factory/Connection/Mock.php" name="lib/Horde/Kolab/Server/Factory/Connection/Mock.php" />
- <install as="Horde/Kolab/Server/Factory/Decorator/Clean.php" name="lib/Horde/Kolab/Server/Factory/Decorator/Clean.php" />
- <install as="Horde/Kolab/Server/Factory/Decorator/Count.php" name="lib/Horde/Kolab/Server/Factory/Decorator/Count.php" />
- <install as="Horde/Kolab/Server/Factory/Decorator/Log.php" name="lib/Horde/Kolab/Server/Factory/Decorator/Log.php" />
- <install as="Horde/Kolab/Server/Factory/Decorator/Map.php" name="lib/Horde/Kolab/Server/Factory/Decorator/Map.php" />
<install as="Horde/Kolab/Server/Ldap/Changes.php" name="lib/Horde/Kolab/Server/Ldap/Changes.php" />
<install as="Horde/Kolab/Server/Ldap/Filtered.php" name="lib/Horde/Kolab/Server/Ldap/Filtered.php" />
<install as="Horde/Kolab/Server/Ldap/Standard.php" name="lib/Horde/Kolab/Server/Ldap/Standard.php" />
<install as="Horde/Kolab/Server/Class/Server/Connection/Mock/LdapTest.php" name="test/Horde/Kolab/Server/Class/Server/Connection/Mock/LdapTest.php" />
<install as="Horde/Kolab/Server/Class/Server/Decorator/CleanTest.php" name="test/Horde/Kolab/Server/Class/Server/Decorator/CleanTest.php" />
<install as="Horde/Kolab/Server/Class/Server/Decorator/LogTest.php" name="test/Horde/Kolab/Server/Class/Server/Decorator/LogTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/ConstructorTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/InjectorTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/InjectorTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/KolabTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/KolabTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/Connection/ConfigurationTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/Connection/InjectorTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/Connection/LdapTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/Connection/MockTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/Decorator/CleanTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CleanTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/Decorator/CountTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/Decorator/CountTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/Decorator/LogTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/Decorator/LogTest.php" />
- <install as="Horde/Kolab/Server/Class/Server/Factory/Decorator/MapTest.php" name="test/Horde/Kolab/Server/Class/Server/Factory/Decorator/MapTest.php" />
<install as="Horde/Kolab/Server/Class/Server/Ldap/ChangesTest.php" name="test/Horde/Kolab/Server/Class/Server/Ldap/ChangesTest.php" />
<install as="Horde/Kolab/Server/Class/Server/Ldap/FilteredTest.php" name="test/Horde/Kolab/Server/Class/Server/Ldap/FilteredTest.php" />
<install as="Horde/Kolab/Server/Class/Server/Ldap/StandardTest.php" name="test/Horde/Kolab/Server/Class/Server/Ldap/StandardTest.php" />
+++ /dev/null
-<?php
-/**
- * Test the configuration based server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the configuration based connection factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the injector based connection factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the ldap connection factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the mock connection factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the mapping server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the cleaner server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the count decorator server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the log decorator server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the mapping server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the injector based server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
+++ /dev/null
-<?php
-/**
- * Test the default Kolab server factory.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package Kolab_Server
- * @author Gunnar Wrobel <wrobel@pardus.de>
- * @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 <wrobel@pardus.de>
- * @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
{
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();
}
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;
}
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;
}