Exemplo n.º 1
0
 public function testConnectBind()
 {
     $ldap = new LDAP\LDAP($this->_options);
     $ldap->connect()->bind();
 }
Exemplo n.º 2
0
 public function testDisconnect()
 {
     $ldap = new LDAP\LDAP($this->_options);
     for ($i = 0; $i < 3; $i++) {
         $ldap->disconnect();
         try {
             $ldap->connect()->bind('CN=ignored,DC=example,DC=com', 'ignored');
             $this->fail('Expected exception for unknown username');
         } catch (LDAP\Exception $zle) {
             $this->assertContains('Invalid credentials', $zle->getMessage());
         }
     }
 }
Exemplo n.º 3
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 (LDAP\Exception $zle) {
         $this->assertContains('Invalid credentials', $zle->getMessage());
     }
 }
Exemplo n.º 4
0
 public function testConnectBind()
 {
     $ldap = new LDAP\LDAP($this->_options);
     $ldap->connect()->bind();
     $this->assertNotNull($ldap->getResource());
 }