Ejemplo n.º 1
0
 /**
  * @group ZF-8274
  */
 public function testConnectWithUri()
 {
     $host = TESTS_ZEND_LDAP_HOST;
     $port = 0;
     if (defined('TESTS_ZEND_LDAP_PORT') && TESTS_ZEND_LDAP_PORT != 389) {
         $port = TESTS_ZEND_LDAP_PORT;
     }
     $useSsl = false;
     if (defined('TESTS_ZEND_LDAP_USE_SSL')) {
         $useSsl = TESTS_ZEND_LDAP_USE_SSL;
     }
     if ($useSsl) {
         $host = 'ldaps://' . $host;
     } else {
         $host = 'ldap://' . $host;
     }
     if ($port) {
         $host = $host . ':' . $port;
     }
     $ldap = new Ldap\Ldap();
     try {
         $ldap->connect($host)->bind('CN=ignored,DC=example,DC=com', 'ignored');
         $this->fail('Expected exception for invalid username');
     } catch (Exception\LdapException $zle) {
         $this->assertContains('Invalid credentials', $zle->getMessage());
     }
 }
Ejemplo n.º 2
0
 public function testConnectBind()
 {
     $ldap = new Ldap\Ldap($this->_options);
     $ldap->connect()->bind();
     $this->assertNotNull($ldap->getResource());
 }