+++ /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 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_Cleaned
-implements Horde_Kolab_Server_Factory
-{
- /**
- * 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 $factory)
- {
- $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_Cleaned($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 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 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_Cleaner
+implements Horde_Kolab_Server_Factory
+{
+ /**
+ * 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 $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_Cleaner($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
}
if (!empty($config['cleanup'])) {
- $factory = new Horde_Kolab_Server_Factory_Cleaned(
- $factory, $config['map']
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $factory
);
}
interface Horde_Kolab_Server_Factory_Conn
{
/**
+ * Get the connection configuration.
+ *
+ * @return array $configuration The configuration parameters.
+ */
+ public function getConfiguration();
+
+ /**
* Set the connection configuration.
*
* @param array $configuration The configuration parameters.
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.
*/
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']);
- }
-
$this->_configuration = $configuration;
}
}
\ No newline at end of file
extends Horde_Kolab_Server_Factory_Conn_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()
{
- $ldap_read = new Net_LDAP2($params);
- if (isset($params['host_master'])) {
- $params['host'] = $params['host_master'];
- $ldap_write = new Net_LDAP2($params);
+ $configuration = $this->getConfiguration();
+ $ldap_read = new Net_LDAP2($configuration);
+ if (isset($configuration['host_master'])) {
+ $configuration['host'] = $configuration['host_master'];
+ $ldap_write = new Net_LDAP2($configuration);
$connection = new Horde_Kolab_Server_Connection_Splittedldap(
$ldap_read, $ldap_write
);
public function getConnection()
{
$connection = new Horde_Kolab_Server_Connection_Mock(
- $this->_configuration
+ $this->getConfiguration()
);
return $connection;
}
implements Horde_Kolab_Server_Factory
{
/**
- * The conn factory class.
- *
- * @param string
- */
- private $_conn_factory;
-
- /**
- * Configuration parameters for the server.
- *
- * @var array
- */
- private $_configuration;
-
- /**
* The injector.
*
* @var Horde_Injector
public function __construct(
Horde_Injector $injector
) {
- $this->_conn_factory = $factory;
- $this->_configuration = $config;
$this->_injector = $injector;
$this->_setup();
}
Horde_Injector $injector
) {
$injector->setInstance(
- 'Horde_Kolab_Server_Config', $config
+ 'Horde_Kolab_Server_Configuration', $config
);
}
*/
private function _setupStructure()
{
- if (!isset($this->_configuration['structure']['driver'])) {
+ $configuration = $this->getConfiguration();
+ if (!isset($configuration['structure']['driver'])) {
$driver = 'Horde_Kolab_Server_Structure_Kolab';
} else {
- $driver = $this->_configuration['structure']['driver'];
+ $driver = $configuration['structure']['driver'];
}
- $injector->bindImplementation('Horde_Kolab_Server_Structure', $driver);
+ $this->_injector->bindImplementation('Horde_Kolab_Server_Structure', $driver);
}
/**
*/
private function _setupConnection()
{
- $injector->bindFactory(
+ $this->_injector->bindFactory(
'Horde_Kolab_Server_Connection',
'Horde_Kolab_Server_Factory_Conn_Injector',
'getConnection'
*/
private function _setupServer()
{
- $injector->bindFactory(
+ $this->_injector->bindFactory(
'Horde_Kolab_Server',
'Horde_Kolab_Server_Factory_Injector',
'getServer'
{
$configuration = $this->getConfiguration();
if (!isset($configuration['basedn'])) {
- throw new Horde_Kolab_Server_Exception('The base DN is missing');
+ throw new Horde_Kolab_Server_Exception('The base DN is missing!');
}
$connection = $this->getConnection();
public function getServer()
{
$server = $this->_factory->getServer();
- $server = new Horde_Kolab_Server_Logged($server);
+ $server = new Horde_Kolab_Server_Logged(
+ $server, $this->_logger
+ );
return $server;
}
<dir name="Kolab">
<file name="Server.php" role="php" />
<dir name="Server">
+ <file name="Cleaner.php" role="php" />
<file name="Composite.php" role="php" />
<file name="Connection.php" role="php" />
<dir name="Connection">
<file name="Factory.php" role="php" />
<dir name="Factory">
<file name="Base.php" role="php" />
- <file name="Cleaned.php" role="php" />
+ <file name="Cleaner.php" role="php" />
<file name="Configuration.php" role="php" />
<file name="Conn.php" role="php" />
<dir name="Conn">
<phprelease>
<filelist>
<install name="lib/Horde/Kolab/Server.php" as="Horde/Kolab/Server.php" />
+ <install name="lib/Horde/Kolab/Server/Cleaner.php" as="Horde/Kolab/Server/Cleaner.php" />
<install name="lib/Horde/Kolab/Server/Composite.php" as="Horde/Kolab/Server/Composite.php" />
<install name="lib/Horde/Kolab/Server/Connection.php" as="Horde/Kolab/Server/Connection.php" />
<install name="lib/Horde/Kolab/Server/Connection/File.php" as="Horde/Kolab/Server/Connection/File.php" />
<install name="lib/Horde/Kolab/Server/Exception/Novalue.php" as="Horde/Kolab/Server/Exception/Novalue.php" />
<install name="lib/Horde/Kolab/Server/Factory.php" as="Horde/Kolab/Server/Factory.php" />
<install name="lib/Horde/Kolab/Server/Factory/Base.php" as="Horde/Kolab/Server/Factory/Base.php" />
- <install name="lib/Horde/Kolab/Server/Factory/Cleaned.php" as="Horde/Kolab/Server/Factory/Cleaned.php" />
+ <install name="lib/Horde/Kolab/Server/Factory/Cleaner.php" as="Horde/Kolab/Server/Factory/Cleaner.php" />
<install name="lib/Horde/Kolab/Server/Factory/Configuration.php" as="Horde/Kolab/Server/Factory/Configuration.php" />
<install name="lib/Horde/Kolab/Server/Factory/Conn.php" as="Horde/Kolab/Server/Factory/Conn.php" />
<install name="lib/Horde/Kolab/Server/Factory/Conn/Base.php" as="Horde/Kolab/Server/Factory/Conn/Base.php" />
*/
public static function suite()
{
- // Catch strict standards
- error_reporting(E_ALL | E_STRICT);
-
$suite = new PHPUnit_Framework_TestSuite('Horde Framework - Kolab_Server');
$basedir = dirname(__FILE__);
. 'error_reporting($oldErrorReporting);'
)
);
-}
\ No newline at end of file
+}
+
+/** Catch strict standards */
+error_reporting(E_ALL | E_STRICT);
--- /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 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_CleanerTest
+extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $this->factory = $this->getMock('Horde_Kolab_Server_Factory');
+ }
+
+ public function testMethodGetserverHasResultCleanerServerIfACleanedWasProvidedInTheConfiguration()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer')
+ ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array('cleanup' => true)
+ );
+ $this->assertType('Horde_Kolab_Server_Cleaner', $factory->getServer());
+ }
+
+ public function testMethodConstructHasParametersFactory()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory
+ );
+ }
+
+ public function testMethodGetconnectionfactoryGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConnectionFactory');
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array()
+ );
+ $factory->getConnectionFactory();
+ }
+
+ public function testMethodGetserverGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer')
+ ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array()
+ );
+ $factory->getServer();
+ }
+
+ public function testMethodGetconfigurationGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConfiguration');
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array()
+ );
+ $factory->getConfiguration();
+ }
+
+ public function testMethodGetconnectionGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConnection');
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array()
+ );
+ $factory->getConnection();
+ }
+
+ public function testMethodGetcompositeGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getComposite');
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array()
+ );
+ $factory->getComposite();
+ }
+
+ public function testMethodGetobjectsGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getObjects');
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array()
+ );
+ $factory->getObjects();
+ }
+
+ public function testMethodGetstructureGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getStructure');
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array()
+ );
+ $factory->getStructure();
+ }
+
+ public function testMethodGetsearchGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getSearch');
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array()
+ );
+ $factory->getSearch();
+ }
+
+ public function testMethodGetschemaGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getSchema');
+ $factory = new Horde_Kolab_Server_Factory_Cleaner(
+ $this->factory, array()
+ );
+ $factory->getSchema();
+ }
+}
\ No newline at end of file
--- /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
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the configuration based server factory.
+ *
+ * Copyright 2009 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 PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $this->factory = $this->getMock('Horde_Kolab_Server_Factory');
+ }
+
+ public function testMethodGetserverHasResultLoggedServerIfALoggerWasProvidedInTheConfiguration()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer')
+ ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array('logger' => 'set')
+ );
+ $this->assertType('Horde_Kolab_Server_Logged', $factory->getServer());
+ }
+
+ public function testMethodGetserverHasResultMappedServerIfAMappedWasProvidedInTheConfiguration()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer')
+ ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array('map' => array())
+ );
+ $this->assertType('Horde_Kolab_Server_Mapped', $factory->getServer());
+ }
+
+ public function testMethodGetserverHasResultCleanerServerIfACleanedWasProvidedInTheConfiguration()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer')
+ ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array('cleanup' => true)
+ );
+ $this->assertType('Horde_Kolab_Server_Cleaner', $factory->getServer());
+ }
+
+ public function testMethodConstructHasParametersFactoryAndArrayParameters()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ }
+
+ public function testMethodGetconnectionfactoryGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConnectionFactory');
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ $factory->getConnectionFactory();
+ }
+
+ public function testMethodGetserverGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer');
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ $factory->getServer();
+ }
+
+ public function testMethodGetconfigurationGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConfiguration');
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ $factory->getConfiguration();
+ }
+
+ public function testMethodGetconnectionGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConnection');
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ $factory->getConnection();
+ }
+
+ public function testMethodGetcompositeGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getComposite');
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ $factory->getComposite();
+ }
+
+ public function testMethodGetobjectsGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getObjects');
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ $factory->getObjects();
+ }
+
+ public function testMethodGetstructureGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getStructure');
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ $factory->getStructure();
+ }
+
+ public function testMethodGetsearchGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getSearch');
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ $factory->getSearch();
+ }
+
+ public function testMethodGetschemaGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getSchema');
+ $factory = new Horde_Kolab_Server_Factory_Configuration(
+ $this->factory, array()
+ );
+ $factory->getSchema();
+ }
+}
\ 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 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_Conn_InjectorTest
+extends PHPUnit_Framework_TestCase
+{
+ public function testMethodGetconnectionHasResultConnection()
+ {
+ $injector = new Horde_Injector(new Horde_Injector_TopLevel());
+ $injector->bindImplementation(
+ 'Horde_Kolab_Server_Factory_Conn',
+ 'Horde_Kolab_Server_Factory_Conn_Mock'
+ );
+ $injector->setInstance(
+ 'Horde_Kolab_Server_Configuration',
+ array()
+ );
+ $factory = new Horde_Kolab_Server_Factory_Conn_Injector($injector);
+ $this->assertType(
+ 'Horde_Kolab_Server_Connection',
+ $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
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../../Autoload.php';
+
+/**
+ * Test the ldap connection factory.
+ *
+ * Copyright 2009 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_Conn_LdapTest
+extends PHPUnit_Framework_TestCase
+{
+ public function testMethodSetconfigurationHasPostconditionThatTheServerParameterWasRewritten()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Conn_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_Conn_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_Conn_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_Conn_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()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Conn_Ldap();
+ $factory->setConfiguration(array('basedn' => 'test'));
+ $this->assertType(
+ 'Horde_Kolab_Server_Connection_Simpleldap',
+ $factory->getConnection()
+ );
+ }
+
+ public function testMethodGetconnectionHasResultConnectionSplittedldapIfTheHostMasterIsSet()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Conn_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 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_Conn_MockTest
+extends PHPUnit_Framework_TestCase
+{
+ public function testMethodGetconfigurationHasResultArrayTheConnectionConfiguration()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Conn_Mock();
+ $factory->setConfiguration(array('basedn' => 'test'));
+ $this->assertEquals(
+ array('basedn' => 'test'),
+ $factory->getConfiguration()
+ );
+ }
+
+ public function testMethodSetconfigurationHasPostconditionThatTheConfigurationWasSaved()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Conn_Mock();
+ $factory->setConfiguration(array());
+ $this->assertEquals(
+ array(),
+ $factory->getConfiguration()
+ );
+ }
+
+ public function testMethodGetconfigurationThrowsExceptionIfNoConfigurationHasBeenSet()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Conn_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_Conn_Mock();
+ $factory->setConfiguration(array('basedn' => 'test'));
+ $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
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the mapping server factory.
+ *
+ * Copyright 2009 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 PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $this->factory = $this->getMock('Horde_Kolab_Server_Factory_Conn');
+ $this->objects = $this->getMock('Horde_Kolab_Server_Objects');
+ $this->structure = $this->getMock('Horde_Kolab_Server_Structure');
+ $this->search = $this->getMock('Horde_Kolab_Server_Search');
+ $this->schema = $this->getMock('Horde_Kolab_Server_Schema');
+ }
+
+ 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->factory->expects($this->once())
+ ->method('getConnection')
+ ->will(
+ $this->returnValue(
+ $this->getMock('Horde_Kolab_Server_Connection')
+ )
+ );
+ $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', $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')
+ )
+ );
+ $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',
+ $factory->getConnection()
+ );
+ }
+
+ public function testMethodGetcompositeReturnsComposite()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConnection')
+ ->will(
+ $this->returnValue(
+ $this->getMock('Horde_Kolab_Server_Connection')
+ )
+ );
+ $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 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
+ */
+
+/**
+ * Prepare the test setup.
+ */
+require_once dirname(__FILE__) . '/../../../Autoload.php';
+
+/**
+ * Test the injector based server factory.
+ *
+ * Copyright 2009 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 PHPUnit_Framework_TestCase
+{
+ private function _getFactory(array $configuration = array())
+ {
+ $injector = new Horde_Injector(new Horde_Injector_TopLevel());
+ Horde_Kolab_Server_Factory_Injector::setup(
+ 'Horde_Kolab_Server_Factory_Conn_Mock',
+ $configuration,
+ $injector
+ );
+ return $injector->getInstance(
+ 'Horde_Kolab_Server_Factory_Injector'
+ );
+ }
+
+ public function testMethodGetconnectionfactoryHasResultConnectionfactory()
+ {
+ $this->assertType(
+ 'Horde_Kolab_Server_Factory_Conn',
+ $this->_getFactory(array())->getConnectionFactory()
+ );
+ }
+
+ public function testMethodGetconnectionHasResultConnection()
+ {
+ $factory = $this->_getFactory(array());
+ $this->assertType(
+ 'Horde_Kolab_Server_Connection',
+ $factory->getConnection()
+ );
+ }
+
+ public function testMethodGetserverHasResultServerldapstandard()
+ {
+ $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()
+ {
+ $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',
+ $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',
+ $factory->getSearch()
+ );
+ }
+
+ public function testMethodGetschemaHasResultSchema()
+ {
+ $factory = $this->_getFactory(array());
+ $this->assertType(
+ 'Horde_Kolab_Server_Schema',
+ $factory->getSchema()
+ );
+ }
+
+ public function testMethodGetcompositeHasResultComposite()
+ {
+ $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 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 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_LoggedTest
+extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $this->factory = $this->getMock('Horde_Kolab_Server_Factory');
+ }
+
+ public function testMethodGetserverHasResultLoggedServerIfALoggerWasProvidedInTheConfiguration()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer')
+ ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ $this->assertType('Horde_Kolab_Server_Logged', $factory->getServer());
+ }
+
+ public function testMethodConstructHasParametersFactoryAndMixedLoggerParameter()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ }
+
+ public function testMethodGetconnectionfactoryGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConnectionFactory');
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ $factory->getConnectionFactory();
+ }
+
+ public function testMethodGetserverGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer')
+ ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ $factory->getServer();
+ }
+
+ public function testMethodGetconfigurationGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConfiguration');
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ $factory->getConfiguration();
+ }
+
+ public function testMethodGetconnectionGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConnection');
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ $factory->getConnection();
+ }
+
+ public function testMethodGetcompositeGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getComposite');
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ $factory->getComposite();
+ }
+
+ public function testMethodGetobjectsGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getObjects');
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ $factory->getObjects();
+ }
+
+ public function testMethodGetstructureGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getStructure');
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ $factory->getStructure();
+ }
+
+ public function testMethodGetsearchGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getSearch');
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $this->factory, 'logger'
+ );
+ $factory->getSearch();
+ }
+
+ public function testMethodGetschemaGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getSchema');
+ $factory = new Horde_Kolab_Server_Factory_Logged(
+ $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 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_MappedTest
+extends PHPUnit_Framework_TestCase
+{
+ public function setUp()
+ {
+ $this->factory = $this->getMock('Horde_Kolab_Server_Factory');
+ }
+
+ public function testMethodGetserverHasResultMappedServer()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer')
+ ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $this->assertType('Horde_Kolab_Server_Mapped', $factory->getServer());
+ }
+
+ public function testMethodConstructHasParametersFactoryAndArrayMapping()
+ {
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ }
+
+ public function testMethodGetconnectionfactoryGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConnectionFactory');
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $factory->getConnectionFactory();
+ }
+
+ public function testMethodGetserverGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getServer')
+ ->will($this->returnValue($this->getMock('Horde_Kolab_Server')));
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $factory->getServer();
+ }
+
+ public function testMethodGetconfigurationGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConfiguration');
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $factory->getConfiguration();
+ }
+
+ public function testMethodGetconnectionGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getConnection');
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $factory->getConnection();
+ }
+
+ public function testMethodGetcompositeGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getComposite');
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $factory->getComposite();
+ }
+
+ public function testMethodGetobjectsGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getObjects');
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $factory->getObjects();
+ }
+
+ public function testMethodGetstructureGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getStructure');
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $factory->getStructure();
+ }
+
+ public function testMethodGetsearchGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getSearch');
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $factory->getSearch();
+ }
+
+ public function testMethodGetschemaGetsDelegated()
+ {
+ $this->factory->expects($this->once())
+ ->method('getSchema');
+ $factory = new Horde_Kolab_Server_Factory_Mapped(
+ $this->factory, array()
+ );
+ $factory->getSchema();
+ }
+}
\ No newline at end of file