From: Gunnar Wrobel Date: Wed, 10 Feb 2010 06:12:03 +0000 (+0100) Subject: Convert to using the newer Horde_Ldap. Does not really work completely yet but the... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1975306a8f8de44bd1f6a0a89639f69cf41c5e86;p=horde.git Convert to using the newer Horde_Ldap. Does not really work completely yet but the test does not error out anymore. --- diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock.php index a9ac54b77..f40a4c5ef 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock.php @@ -31,14 +31,14 @@ implements Horde_Kolab_Server_Connection_Interface /** * The LDAP connection handle. * - * @var Net_LDAP2 + * @var Horde_Ldap */ private $_ldap; /** * Constructor * - * @param Net_LDAP2 $ldap The ldap connection. + * @param Horde_Ldap $ldap The ldap connection. */ public function __construct(Horde_Kolab_Server_Connection_Mock_Ldap $ldap) { diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Ldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Ldap.php index eb7d2eb10..18b921e5c 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Ldap.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Ldap.php @@ -107,7 +107,7 @@ class Horde_Kolab_Server_Connection_Mock_Ldap * @param string $dn DN of the entry that should be fetched * @param array $attr Array of Attributes to select. If ommitted, all attributes are fetched. * - * @return Net_LDAP2_Entry|Net_LDAP2_Error Reference to a Net_LDAP2_Entry object or Net_LDAP2_Error object + * @return Horde_Ldap_Entry|Horde_Ldap_Error Reference to a Horde_Ldap_Entry object or Horde_Ldap_Error object * @todo Maybe check against the shema should be done to be sure the attribute type exists */ public function getEntry($dn, $attr = array()) @@ -257,7 +257,7 @@ class Horde_Kolab_Server_Connection_Mock_Ldap } else { $result['att'] = $filter_parts[0]; $result['log'] = $filter_parts[1]; - $val = Net_LDAP2_Util::unescape_filter_value($filter_parts[2]); + $val = Horde_Ldap_Util::unescape_filter_value($filter_parts[2]); $result['val'] = $val[0]; return $result; } @@ -421,9 +421,9 @@ class Horde_Kolab_Server_Connection_Mock_Ldap /** * Add a new entryobject to a directory. * - * @param Net_LDAP2_Entry $entry Net_LDAP2_Entry + * @param Horde_Ldap_Entry $entry Horde_Ldap_Entry * - * @return Net_LDAP2_Error|true Net_LDAP2_Error object or true + * @return Horde_Ldap_Error|true Horde_Ldap_Error object or true */ public function add($entry) { @@ -443,11 +443,11 @@ class Horde_Kolab_Server_Connection_Mock_Ldap /** * Modify an ldapentry directly on the server * - * @param string|Net_LDAP2_Entry &$entry DN-string or Net_LDAP2_Entry + * @param string|Horde_Ldap_Entry &$entry DN-string or Horde_Ldap_Entry * @param array $parms Array of changes * * @access public - * @return Net_LDAP2_Error|true Net_LDAP2_Error object or true + * @return Horde_Ldap_Error|true Horde_Ldap_Error object or true */ public function modify($entry, $data = array()) { diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Search.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Search.php index b77e1743d..8c99031bf 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Search.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Mock/Search.php @@ -26,7 +26,7 @@ * @link http://pear.horde.org/index.php?package=Kolab_Server */ class Horde_Kolab_Server_Connection_Mock_Search -extends Net_LDAP2_Search +extends Horde_Ldap_Search { /** * The search result. diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Simpleldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Simpleldap.php index cd938f30f..b5ccb920b 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Simpleldap.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Simpleldap.php @@ -31,16 +31,16 @@ implements Horde_Kolab_Server_Connection_Interface /** * The LDAP connection handle. * - * @var Net_LDAP2 + * @var Horde_Ldap */ private $_ldap; /** * Constructor * - * @param Net_LDAP2 $ldap The ldap connection. + * @param Horde_Ldap $ldap The ldap connection. */ - public function __construct(Net_LDAP2 $ldap) + public function __construct(Horde_Ldap $ldap) { $this->_ldap = $ldap; } diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Splittedldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Splittedldap.php index 26506cc42..65b70a231 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Splittedldap.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Connection/Splittedldap.php @@ -31,26 +31,26 @@ implements Horde_Kolab_Server_Connection_Interface /** * LDAP read connection handle. * - * @var Net_LDAP2 + * @var Horde_Ldap */ private $_ldap_read; /** * LDAP write connection handle. * - * @var Net_LDAP2 + * @var Horde_Ldap */ private $_ldap_write; /** * Constructor * - * @param Net_LDAP2 $ldap_read The ldap_read connection. - * @param Net_LDAP2 $ldap_write The ldap_write connection. + * @param Horde_Ldap $ldap_read The ldap_read connection. + * @param Horde_Ldap $ldap_write The ldap_write connection. */ public function __construct( - Net_LDAP2 $ldap_read, - Net_LDAP2 $ldap_write + Horde_Ldap $ldap_read, + Horde_Ldap $ldap_write ) { $this->_ldap_read = $ldap_read; $this->_ldap_write = $ldap_write; diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Clean.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Clean.php index 45144b4be..0584f3a39 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Clean.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Clean.php @@ -226,7 +226,7 @@ implements Horde_Kolab_Server_Interface /** * Return the ldap schema. * - * @return Net_LDAP2_Schema The LDAP schema. + * @return Horde_Ldap_Schema The LDAP schema. * * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed. */ diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php index ce252c759..a3d51f547 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Count.php @@ -259,7 +259,7 @@ implements Horde_Kolab_Server_Interface /** * Return the ldap schema. * - * @return Net_LDAP2_Schema The LDAP schema. + * @return Horde_Ldap_Schema The LDAP schema. * * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed. */ diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php index 2b8cda5e0..89a054968 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Log.php @@ -301,7 +301,7 @@ implements Horde_Kolab_Server_Interface /** * Return the ldap schema. * - * @return Net_LDAP2_Schema The LDAP schema. + * @return Horde_Ldap_Schema The LDAP schema. * * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed. */ diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Map.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Map.php index e476163f4..55bb8596b 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Map.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Decorator/Map.php @@ -256,7 +256,7 @@ implements Horde_Kolab_Server_Interface /** * Return the ldap schema. * - * @return Net_LDAP2_Schema The LDAP schema. + * @return Horde_Ldap_Schema The LDAP schema. * * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed. */ diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php index adb00451b..3a241f39c 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Factory/Connection/Ldap.php @@ -67,10 +67,10 @@ extends Horde_Kolab_Server_Factory_Connection_Base public function getConnection() { $configuration = $this->getConfiguration(); - $ldap_read = new Net_LDAP2($configuration); + $ldap_read = new Horde_Ldap($configuration); if (isset($configuration['host_master'])) { $configuration['host'] = $configuration['host_master']; - $ldap_write = new Net_LDAP2($configuration); + $ldap_write = new Horde_Ldap($configuration); $connection = new Horde_Kolab_Server_Connection_Splittedldap( $ldap_read, $ldap_write ); diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Ldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Ldap.php index 881c07cc5..c25fb3ef8 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Ldap.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Ldap.php @@ -66,7 +66,7 @@ implements Horde_Kolab_Server_Interface $this->_base_dn = $base_dn; $this->_handleError( - Net_LDAP2::checkLDAPExtension(), + Horde_Ldap::checkLDAPExtension(), Horde_Kolab_Server_Exception::MISSING_LDAP_EXTENSION ); } @@ -221,7 +221,7 @@ implements Horde_Kolab_Server_Interface Horde_Kolab_Server_Object_Interface $object, array $data ) { - $entry = Net_LDAP2_Entry::createFresh($object->getGuid(), $data); + $entry = Horde_Ldap_Entry::createFresh($object->getGuid(), $data); $this->_handleError($entry, Horde_Kolab_Server_Exception::SYSTEM); $this->_handleError( $this->_conn->getWrite()->add($entry), @@ -267,7 +267,7 @@ implements Horde_Kolab_Server_Interface /** * Return the ldap schema. * - * @return Net_LDAP2_Schema The LDAP schema. + * @return Horde_Ldap_Schema The LDAP schema. * * @throws Horde_Kolab_Server_Exception If retrieval of the schema failed. */ @@ -287,7 +287,7 @@ implements Horde_Kolab_Server_Interface */ public function getParentGuid($guid) { - $base = Net_LDAP2_Util::ldap_explode_dn( + $base = Horde_Ldap_Util::ldap_explode_dn( $guid, array( 'casefold' => 'none', @@ -297,7 +297,7 @@ implements Horde_Kolab_Server_Interface ); $this->_handleError($base); $id = array_shift($base); - $parent = Net_LDAP2_Util::canonical_dn( + $parent = Horde_Ldap_Util::canonical_dn( $base, array('casefold' => 'none') ); $this->_handleError($parent); diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Ldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Ldap.php index 846c9e5d8..516c15abb 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Ldap.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Query/Ldap.php @@ -185,7 +185,7 @@ implements Horde_Kolab_Server_Query_Interface Horde_Kolab_Server_Query_Element_Single $single, $operator ) { - $result = Net_LDAP2_Filter::create( + $result = Horde_Ldap_Filter::create( $this->_structure->mapExternalToInternalAttribute( $single->getName() ), @@ -208,7 +208,7 @@ implements Horde_Kolab_Server_Query_Interface public function convertNot(Horde_Kolab_Server_Query_Element_Not $not) { $elements = $not->getElements(); - $result = Net_LDAP2_Filter::combine('!', $elements[0]->convert($this)); + $result = Horde_Ldap_Filter::combine('!', $elements[0]->convert($this)); $this->_handleError($result); return $result; } @@ -259,7 +259,7 @@ implements Horde_Kolab_Server_Query_Interface foreach ($group->getElements() as $element) { $filters[] = $element->convert($this); } - $result = Net_LDAP2_Filter::combine($operator, $filters); + $result = Horde_Ldap_Filter::combine($operator, $filters); $this->_handleError($result); return $result; } diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Result/Ldap.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Result/Ldap.php index f2aee7a24..89af79af3 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Result/Ldap.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Result/Ldap.php @@ -31,16 +31,16 @@ implements Horde_Kolab_Server_Result_Interface /** * The search result. * - * @var Net_LDAP2_Search + * @var Horde_Ldap_Search */ private $_search; /** * Constructor. * - * @param Net_LDAP2_Search $search The LDAP search result. + * @param Horde_Ldap_Search $search The LDAP search result. */ - public function __construct(Net_LDAP2_Search $search) + public function __construct(Horde_Ldap_Search $search) { $this->_search = $search; } diff --git a/framework/Kolab_Server/package.xml b/framework/Kolab_Server/package.xml index 65cc45e27..92e1b1aa4 100644 --- a/framework/Kolab_Server/package.xml +++ b/framework/Kolab_Server/package.xml @@ -345,8 +345,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> pear.horde.org - Net_LDAP2 - pear.php.net + Horde_Ldap + pear.horde.org ldap diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Connection/SimpleldapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Connection/SimpleldapTest.php index aaa12c970..bda065644 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Connection/SimpleldapTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Connection/SimpleldapTest.php @@ -35,27 +35,27 @@ extends Horde_Kolab_Server_LdapTestCase { public function testMethodConstructHasParameterNetldap2Connection() { - $ldap = $this->getMock('Net_LDAP2'); + $ldap = $this->getMock('Horde_Ldap'); $conn = new Horde_Kolab_Server_Connection_Simpleldap($ldap); } public function testMethodConstructHasPostconditionThatTheGivenServerWasStored() { - $ldap = $this->getMock('Net_LDAP2'); + $ldap = $this->getMock('Horde_Ldap'); $conn = new Horde_Kolab_Server_Connection_Simpleldap($ldap); $this->assertSame($ldap, $conn->getRead()); } public function testMethodGetreadHasResultNetldap2TheHandledConnection() { - $ldap = $this->getMock('Net_LDAP2'); + $ldap = $this->getMock('Horde_Ldap'); $conn = new Horde_Kolab_Server_Connection_Simpleldap($ldap); - $this->assertType('Net_LDAP2', $conn->getRead()); + $this->assertType('Horde_Ldap', $conn->getRead()); } public function testMethodGetwriteHasResultNetldap2TheHandledConnection() { - $ldap = $this->getMock('Net_LDAP2'); + $ldap = $this->getMock('Horde_Ldap'); $conn = new Horde_Kolab_Server_Connection_Simpleldap($ldap); $this->assertSame($conn->getWrite(), $conn->getRead()); } diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Connection/SplittedldapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Connection/SplittedldapTest.php index 3d845ca1a..a0015621a 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Connection/SplittedldapTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Connection/SplittedldapTest.php @@ -35,15 +35,15 @@ extends Horde_Kolab_Server_LdapTestCase { public function testMethodConstructHasParameterNetldap2ReadConnectionAndParameterNetldap2WriteConnection() { - $ldap_read = $this->getMock('Net_LDAP2'); - $ldap_write = $this->getMock('Net_LDAP2'); + $ldap_read = $this->getMock('Horde_Ldap'); + $ldap_write = $this->getMock('Horde_Ldap'); $conn = new Horde_Kolab_Server_Connection_Splittedldap($ldap_read, $ldap_write); } public function testMethodConstructHasPostconditionThatTheGivenServersWereStored() { - $ldap_read = $this->getMock('Net_LDAP2'); - $ldap_write = $this->getMock('Net_LDAP2'); + $ldap_read = $this->getMock('Horde_Ldap'); + $ldap_write = $this->getMock('Horde_Ldap'); $conn = new Horde_Kolab_Server_Connection_Splittedldap($ldap_read, $ldap_write); $this->assertSame($ldap_read, $conn->getRead()); $this->assertSame($ldap_write, $conn->getWrite()); @@ -51,17 +51,17 @@ extends Horde_Kolab_Server_LdapTestCase public function testMethodGetreadHasResultNetldap2TheHandledConnection() { - $ldap_read = $this->getMock('Net_LDAP2'); - $ldap_write = $this->getMock('Net_LDAP2'); + $ldap_read = $this->getMock('Horde_Ldap'); + $ldap_write = $this->getMock('Horde_Ldap'); $conn = new Horde_Kolab_Server_Connection_Splittedldap($ldap_read, $ldap_write); - $this->assertType('Net_LDAP2', $conn->getRead()); - $this->assertType('Net_LDAP2', $conn->getWrite()); + $this->assertType('Horde_Ldap', $conn->getRead()); + $this->assertType('Horde_Ldap', $conn->getWrite()); } public function testMethodGetwriteHasResultNetldap2TheHandledConnection() { - $ldap_read = $this->getMock('Net_LDAP2'); - $ldap_write = $this->getMock('Net_LDAP2'); + $ldap_read = $this->getMock('Horde_Ldap'); + $ldap_write = $this->getMock('Horde_Ldap'); $conn = new Horde_Kolab_Server_Connection_Splittedldap($ldap_read, $ldap_write); $this->assertFalse($conn->getWrite() === $conn->getRead()); } diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/FilteredTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/FilteredTest.php index 307047868..c22f84f1f 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/FilteredTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/FilteredTest.php @@ -36,8 +36,8 @@ class Horde_Kolab_Server_Class_Server_Ldap_FilteredTest extends Horde_Kolab_Serv { $this->skipIfNoLdap(); - $this->ldap_read = $this->getMock('Net_LDAP2'); - $this->ldap_write = $this->getMock('Net_LDAP2'); + $this->ldap_read = $this->getMock('Horde_Ldap'); + $this->ldap_write = $this->getMock('Horde_Ldap'); $connection = new Horde_Kolab_Server_Connection_Splittedldap( $this->ldap_read, $this->ldap_write @@ -53,7 +53,7 @@ class Horde_Kolab_Server_Class_Server_Ldap_FilteredTest extends Horde_Kolab_Serv private function getSearchResultMock() { $result = $this->getMock( - 'Net_LDAP2_Search', array('as_struct', 'count'), array(), '', false + 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false ); $result->expects($this->any()) ->method('as_struct') diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/StandardTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/StandardTest.php index 01d367b52..fab3e2799 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/StandardTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Ldap/StandardTest.php @@ -36,8 +36,8 @@ class Horde_Kolab_Server_Class_Server_Ldap_StandardTest extends Horde_Kolab_Serv { $this->skipIfNoLdap(); - $this->ldap_read = $this->getMock('Net_LDAP2'); - $this->ldap_write = $this->getMock('Net_LDAP2'); + $this->ldap_read = $this->getMock('Horde_Ldap'); + $this->ldap_write = $this->getMock('Horde_Ldap'); $connection = new Horde_Kolab_Server_Connection_Splittedldap( $this->ldap_read, $this->ldap_write @@ -52,7 +52,7 @@ class Horde_Kolab_Server_Class_Server_Ldap_StandardTest extends Horde_Kolab_Serv private function getSearchResultMock() { $result = $this->getMock( - 'Net_LDAP2_Search', array('as_struct', 'count'), array(), '', false + 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false ); $result->expects($this->any()) ->method('as_struct') diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/LdapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/LdapTest.php index 5537d0be9..585b953e4 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/LdapTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/LdapTest.php @@ -36,8 +36,8 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe { $this->skipIfNoLdap(); - $this->ldap_read = $this->getMock('Net_LDAP2'); - $this->ldap_write = $this->getMock('Net_LDAP2'); + $this->ldap_read = $this->getMock('Horde_Ldap'); + $this->ldap_write = $this->getMock('Horde_Ldap'); $connection = new Horde_Kolab_Server_Connection_Splittedldap( $this->ldap_read, $this->ldap_write @@ -52,7 +52,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe private function getSearchResultMock() { $result = $this->getMock( - 'Net_LDAP2_Search', array('as_struct', 'count'), array(), '', false + 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false ); $result->expects($this->any()) ->method('as_struct') @@ -164,7 +164,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe public function testMethodReadThrowsExceptionIfTheObjectWasNotFound() { $result = $this->getMock( - 'Net_LDAP2_Search', array('as_struct', 'count'), array(), '', false + 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false ); $result->expects($this->exactly(1)) ->method('count') @@ -211,7 +211,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe public function testMethodReadAttributesThrowsExceptionIfTheObjectWasNotFound() { $result = $this->getMock( - 'Net_LDAP2_Search', array('as_struct', 'count'), array(), '', false + 'Horde_Ldap_Search', array('as_struct', 'count'), array(), '', false ); $result->expects($this->exactly(1)) ->method('count') @@ -276,7 +276,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe public function testMethodSaveHasParameterObjectTheObjectToModifyOnTheServer() { $entry = $this->getMock( - 'Net_LDAP2_Entry', array(), array(), '', false + 'Horde_Ldap_Entry', array(), array(), '', false ); $object = $this->getMock('Horde_Kolab_Server_Object_Interface'); $this->ldap_write->expects($this->exactly(1)) @@ -284,7 +284,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe ->will($this->returnValue($entry)); $this->ldap_write->expects($this->exactly(1)) ->method('modify') - ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Net_LDAP2_Entry')); + ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Horde_Ldap_Entry')); $object->expects($this->exactly(1)) ->method('readInternal') ->will($this->returnValue(array())); @@ -294,7 +294,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe public function testMethodSaveHasParameterArrayData() { $entry = $this->getMock( - 'Net_LDAP2_Entry', array(), array(), '', false + 'Horde_Ldap_Entry', array(), array(), '', false ); $object = $this->getMock('Horde_Kolab_Server_Object_Interface'); $this->ldap_write->expects($this->exactly(1)) @@ -302,7 +302,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe ->will($this->returnValue($entry)); $this->ldap_write->expects($this->exactly(1)) ->method('modify') - ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Net_LDAP2_Entry')); + ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Horde_Ldap_Entry')); $object->expects($this->exactly(1)) ->method('readInternal') ->will($this->returnValue(array())); @@ -312,7 +312,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe public function testMethodSaveHasPostconditionThatTheEntryWasModified() { $entry = $this->getMock( - 'Net_LDAP2_Entry', array(), array(), '', false + 'Horde_Ldap_Entry', array(), array(), '', false ); $object = $this->getMock('Horde_Kolab_Server_Object_Interface'); $this->ldap_write->expects($this->exactly(1)) @@ -320,7 +320,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe ->will($this->returnValue($entry)); $this->ldap_write->expects($this->exactly(1)) ->method('modify') - ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Net_LDAP2_Entry')); + ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Horde_Ldap_Entry')); $object->expects($this->exactly(1)) ->method('readInternal') ->will($this->returnValue(array())); @@ -350,7 +350,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe $object = $this->getMock('Horde_Kolab_Server_Object_Interface'); $this->ldap_write->expects($this->exactly(1)) ->method('add') - ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Net_LDAP2_Entry')); + ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Horde_Ldap_Entry')); $this->server->add($object, array('attributes' => array('dn'))); } @@ -359,7 +359,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe $object = $this->getMock('Horde_Kolab_Server_Object_Interface'); $this->ldap_write->expects($this->exactly(1)) ->method('add') - ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Net_LDAP2_Entry')); + ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Horde_Ldap_Entry')); $this->server->add($object, array('dn' => 'test')); } @@ -368,7 +368,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe $object = $this->getMock('Horde_Kolab_Server_Object_Interface'); $this->ldap_write->expects($this->exactly(1)) ->method('add') - ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Net_LDAP2_Entry')); + ->with(new PHPUnit_Framework_Constraint_IsInstanceOf('Horde_Ldap_Entry')); $this->server->add($object, array('dn' => 'test')); } @@ -489,7 +489,7 @@ class Horde_Kolab_Server_Class_Server_LdapTest extends Horde_Kolab_Server_LdapTe /* public function testMethodSearchReturnsArrayMappedSearchResultIfMappingIsActivated() */ /* { */ -/* $ldap = $this->getMock('Net_LDAP2', array('search')); */ +/* $ldap = $this->getMock('Horde_Ldap', array('search')); */ /* $ldap->expects($this->exactly(1)) */ /* ->method('search') */ /* ->will($this->returnValue(new Search_Mock(array(array('dn2' => 'test'))))); */ diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Query/LdapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Query/LdapTest.php index 7e3b5e666..04e6a1691 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Query/LdapTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Query/LdapTest.php @@ -215,18 +215,11 @@ class Horde_Kolab_Server_Class_Server_Query_LdapTest extends Horde_Kolab_Server_ $or = new Horde_Kolab_Server_Query_Element_Or(array($equals)); $query = new Horde_Kolab_Server_Query_Ldap($or, $this->structure); - /** Hide strict errors from the Net_LDAP2 library */ - $error_reporting = error_reporting(); - error_reporting($error_reporting & ~E_STRICT); - try { $query->convertOr($or)->asString(); $this->fail('No exception!'); } catch (Horde_Kolab_Server_Exception $e) { $this->assertEquals(Horde_Kolab_Server_Exception::INVALID_QUERY, $e->getCode()); } - - /** Reactivate original error reporting */ - error_reporting($error_reporting); } } diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Result/LdapTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Result/LdapTest.php index adccba792..78dabec6e 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Result/LdapTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Result/LdapTest.php @@ -35,7 +35,7 @@ class Horde_Kolab_Server_Class_Server_Result_LdapTest extends Horde_Kolab_Server public function testMethodConstructHasParameterNetldap2searchSearchResult() { $search = $this->getMock( - 'Net_LDAP2_Search', array(), array(), '', false + 'Horde_Ldap_Search', array(), array(), '', false ); $result = new Horde_Kolab_Server_Result_Ldap($search); } @@ -44,7 +44,7 @@ class Horde_Kolab_Server_Class_Server_Result_LdapTest extends Horde_Kolab_Server public function testMethodCountHasResultIntTheNumberOfElementsFound() { $search = $this->getMock( - 'Net_LDAP2_Search', array('count'), array(), '', false + 'Horde_Ldap_Search', array('count'), array(), '', false ); $search->expects($this->exactly(1)) ->method('count') @@ -56,7 +56,7 @@ class Horde_Kolab_Server_Class_Server_Result_LdapTest extends Horde_Kolab_Server public function testMethodSizelimitexceededHasResultBooleanIndicatingIfTheSearchSizeLimitWasHit() { $search = $this->getMock( - 'Net_LDAP2_Search', array('sizeLimitExceeded'), array(), '', false + 'Horde_Ldap_Search', array('sizeLimitExceeded'), array(), '', false ); $search->expects($this->exactly(1)) ->method('sizeLimitExceeded') @@ -68,7 +68,7 @@ class Horde_Kolab_Server_Class_Server_Result_LdapTest extends Horde_Kolab_Server public function testMethodAsarrayHasResultArrayWithTheSearchResults() { $search = $this->getMock( - 'Net_LDAP2_Search', array('as_struct'), array(), '', false + 'Horde_Ldap_Search', array('as_struct'), array(), '', false ); $search->expects($this->exactly(1)) ->method('as_struct') diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/MockTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/MockTest.php index b004ad6f3..992d711f1 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/MockTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/MockTest.php @@ -85,17 +85,10 @@ class Horde_Kolab_Server_Integration_MockTest extends Horde_Kolab_Server_Integra $this->markTestSuiteSkipped('Ldap extension is missing!'); }; - /** Hide strict errors from the Net_LDAP2 library */ - $error_reporting = error_reporting(); - error_reporting($error_reporting & ~E_STRICT); - - if (!class_exists('Net_LDAP2')) { - $this->markTestSuiteSkipped('PEAR package Net_LDAP2 is not installed!'); + if (!class_exists('Horde_Ldap')) { + $this->markTestSuiteSkipped('PEAR package Horde_Ldap is not installed!'); } - /** Reactivate original error reporting */ - error_reporting($error_reporting); - $this->markTestIncomplete('Needs to be fixed'); $this->initializeEnvironments(); @@ -396,7 +389,7 @@ class Horde_Kolab_Server_Integration_MockTest extends Horde_Kolab_Server_Integra { foreach ($this->servers as $server) { $filter = '(&(objectClass=kolabGroupOfNames)(member=' - . Net_LDAP2_Util::escape_filter_value('cn=The Administrator,dc=example,dc=org') . '))'; + . Horde_Ldap_Util::escape_filter_value('cn=The Administrator,dc=example,dc=org') . '))'; $result = $server->search($filter, array()); $this->assertTrue(!empty($result)); diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/PersonTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/PersonTest.php index 0b557e59d..3a92d9fad 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/PersonTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Integration/PersonTest.php @@ -160,8 +160,8 @@ class Horde_Kolab_Server_Integration_PersonTest extends Horde_Kolab_Server_Integ $this->assertNoError($result); $cn_result = $server->uidForCn($this->objects[$add]['Cn']); $this->assertNoError($cn_result); - $dn_parts = Net_LDAP2_Util::ldap_explode_dn($cn_result, array('casefold' => 'lower')); - $dnpart = Net_LDAP2_Util::unescape_dn_value($dn_parts[0]); + $dn_parts = Horde_Ldap_Util::ldap_explode_dn($cn_result, array('casefold' => 'lower')); + $dnpart = Horde_Ldap_Util::unescape_dn_value($dn_parts[0]); /** * @todo: I currently do not really understand why the forward slash * is not correctly converted back but I lack the time to analyse it @@ -238,8 +238,8 @@ class Horde_Kolab_Server_Integration_PersonTest extends Horde_Kolab_Server_Integ $cn_result = $server->uidForCn($this->objects[5]['Cn'][0]); $this->assertNoError($cn_result); - $dn_parts = Net_LDAP2_Util::ldap_explode_dn($cn_result, array('casefold' => 'lower')); - $dnpart = Net_LDAP2_Util::unescape_dn_value($dn_parts[0]); + $dn_parts = Horde_Ldap_Util::ldap_explode_dn($cn_result, array('casefold' => 'lower')); + $dnpart = Horde_Ldap_Util::unescape_dn_value($dn_parts[0]); $this->assertContains('Cn' . '=' . $this->objects[5]['Cn'][0], $dnpart[0]); } diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/LdapTestCase.php b/framework/Kolab_Server/test/Horde/Kolab/Server/LdapTestCase.php index ff81ed44e..ee90db82c 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/LdapTestCase.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/LdapTestCase.php @@ -1,6 +1,6 @@ markTestSuiteSkipped('Ldap extension is missing!'); + $this->markTestSkipped('Ldap extension is missing!'); }; - /** Hide strict errors from the Net_LDAP2 library */ - $error_reporting = error_reporting(); - error_reporting($error_reporting & ~E_STRICT); - - if (!class_exists('Net_LDAP2')) { - $this->markTestSkipped('PEAR package Net_LDAP2 is not installed!'); + if (!class_exists('Horde_Ldap')) { + $this->markTestSkipped('Horde_Ldap is not installed!'); } - - /** Reactivate original error reporting */ - error_reporting($error_reporting); } } \ No newline at end of file diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/TestCase.php b/framework/Kolab_Server/test/Horde/Kolab/Server/TestCase.php index 0843e9e0d..0ab0c493c 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/TestCase.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/TestCase.php @@ -24,7 +24,7 @@ require_once dirname(__FILE__) . '/Constraints/Searchcn.php'; require_once dirname(__FILE__) . '/Constraints/Searchalias.php'; /** - * Skip LDAP based tests if we don't have ldap or Net_LDAP2. + * Provides functions required by several Kolab_Server tests. * * Copyright 2009-2010 The Horde Project (http://www.horde.org/) *