97d6f7d3623ec45eaf308f738c8275f3709d04ac
[horde.git] /
1 <?php
2 /**
3  * Test the configuration based connection factory.
4  *
5  * PHP version 5
6  *
7  * @category Kolab
8  * @package  Kolab_Server
9  * @author   Gunnar Wrobel <wrobel@pardus.de>
10  * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
11  * @link     http://pear.horde.org/index.php?package=Kolab_Server
12  */
13
14 /**
15  * Require our basic test case definition
16  */
17 require_once dirname(__FILE__) . '/../../../../LdapTestCase.php';
18
19 /**
20  * Test the configuration based connection factory.
21  *
22  * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
23  *
24  * See the enclosed file COPYING for license information (LGPL). If you
25  * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
26  *
27  * @category Kolab
28  * @package  Kolab_Server
29  * @author   Gunnar Wrobel <wrobel@pardus.de>
30  * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
31  * @link     http://pear.horde.org/index.php?package=Kolab_Server
32  */
33 class Horde_Kolab_Server_Class_Server_Factory_Connection_ConfigurationTest
34 extends Horde_Kolab_Server_LdapTestCase
35 {
36     public function testMethodConstructHasParameterArrayConfiguration()
37     {
38         $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
39             array('basedn' => 'a')
40         );
41     }
42
43     public function testMethodConstructHasPostconditionThatTheConfigurationWasSaved()
44     {
45         $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
46             array('basedn' => 'a')
47         );
48         $this->assertEquals(array('basedn' => 'a'), $factory->getConfiguration());
49     }
50
51     public function testMethodConstructHasResultArrayTheConfiguration()
52     {
53         $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
54             array('basedn' => 'a')
55         );
56         $this->assertType('array', $factory->getConfiguration());
57     }
58
59     public function testMethodConstructHasPostconditionThatTheConnectionFactoryHasBeenSet()
60     {
61         $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
62             array('mock' => true)
63         );
64         $this->assertType('Horde_Kolab_Server_Connection_Mock', $factory->getConnection());
65     }
66
67     public function testMethodGetconnectionHasResultMockConnectionIfConfiguredThatWay()
68     {
69         $this->testMethodConstructHasPostconditionThatTheConnectionFactoryHasBeenSet();
70     }
71
72     public function testMethodGetconnectionHasResultLdapConnectionIfConfiguredThatWay()
73     {
74         $this->skipIfNoLdap();
75         $factory = new Horde_Kolab_Server_Factory_Connection_Configuration(
76             array('basedn' => 'a')
77         );
78         $this->assertType('Horde_Kolab_Server_Connection_Simpleldap', $factory->getConnection());
79     }
80 }