/**
* 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)
{
* @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())
} 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;
}
/**
* 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)
{
/**
* 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())
{
* @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.
/**
* 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;
}
/**
* 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;
/**
* 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.
*/
/**
* 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.
*/
/**
* 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.
*/
/**
* 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.
*/
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
);
$this->_base_dn = $base_dn;
$this->_handleError(
- Net_LDAP2::checkLDAPExtension(),
+ Horde_Ldap::checkLDAPExtension(),
Horde_Kolab_Server_Exception::MISSING_LDAP_EXTENSION
);
}
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),
/**
* 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.
*/
*/
public function getParentGuid($guid)
{
- $base = Net_LDAP2_Util::ldap_explode_dn(
+ $base = Horde_Ldap_Util::ldap_explode_dn(
$guid,
array(
'casefold' => 'none',
);
$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);
Horde_Kolab_Server_Query_Element_Single $single,
$operator
) {
- $result = Net_LDAP2_Filter::create(
+ $result = Horde_Ldap_Filter::create(
$this->_structure->mapExternalToInternalAttribute(
$single->getName()
),
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;
}
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;
}
/**
* 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;
}
<channel>pear.horde.org</channel>
</package>
<package>
- <name>Net_LDAP2</name>
- <channel>pear.php.net</channel>
+ <name>Horde_Ldap</name>
+ <channel>pear.horde.org</channel>
</package>
<extension>
<name>ldap</name>
{
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());
}
{
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());
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());
}
{
$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
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')
{
$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
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')
{
$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
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')
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')
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')
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))
->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()));
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))
->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()));
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))
->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()));
$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')));
}
$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'));
}
$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'));
}
/* 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'))))); */
$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);
}
}
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);
}
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')
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')
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')
$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();
{
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));
$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
$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]);
}
<?php
/**
- * Skip LDAP based tests if we don't have ldap or Net_LDAP2.
+ * Skip LDAP based tests if we don't have ldap or Horde_Ldap.
*
* PHP version 5
*
require_once dirname(__FILE__) . '/TestCase.php';
/**
- * Skip LDAP based tests if we don't have ldap or Net_LDAP2.
+ * Skip LDAP based tests if we don't have ldap or Horde_Ldap.
*
* Copyright 2009-2010 The Horde Project (http://www.horde.org/)
*
public function skipIfNoLdap()
{
if (!extension_loaded('ldap') && !@dl('ldap.' . PHP_SHLIB_SUFFIX)) {
- $this->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
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/)
*