function LdapServerTest::dnExists in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_test/LdapServerTest.class.php \LdapServerTest::dnExists()
 
does dn exist for this server?
Parameters
string $dn:
enum $return = 'boolean' or 'ldap_entry':
return FALSE or ldap entry array:
Overrides LdapServer::dnExists
File
- ldap_test/
LdapServerTest.class.php, line 350  - Simpletest ldapServer class for testing without an actual ldap server
 
Class
Code
function dnExists($find_dn, $return = 'boolean', $attributes = array(
  'objectclass',
)) {
  $this
    ->refreshFakeData();
  $test_data = variable_get('ldap_test_server__' . $this->sid, array());
  foreach ($this->entries as $entry_dn => $entry) {
    $match = strcasecmp($entry_dn, $find_dn) == 0;
    if ($match) {
      //  debug("testserver:dnExists,match=$match, entry_dn=$entry_dn, find_dn=$find_dn"); debug($entry);
      return $return == 'boolean' ? TRUE : $entry;
    }
  }
  // debug("testserver:dnExists, no match");
  return FALSE;
  // not match found in loop
}