public function testSlapdErrorFunctions() { $config = TestsHelper::getLdapConfig(214); $ldap = new SHLdap($config); $ldap->connect(); $ldap->proxyBind(); try { $ldap->read('cn=doesntexist,dc=shmanic,dc=net'); } catch (Exception $e) { if ($code = $ldap->getErrorCode() === 32) { if (!$ldap->getErrorMsg() === SHLdap::errorToString($code)) { $this->fail('Incorrect response message'); } } } }
/** * Converts the Ldap Error ID into a readable message. * * @return string Error Message. * * @since 2.0 */ public final function getLdapMessage() { if (!is_null($this->ldapCode)) { // Convert ID to string return SHLdap::errorToString($this->ldapCode); } return null; }