public function testRequiresDnWithoutDnBind() { $options = $this->_options; /* Fixup filter since bindRequiresDn is used to determine default accountFilterFormat */ if (!isset($options['accountFilterFormat']) && !$this->_bindRequiresDn) { $options['accountFilterFormat'] = '(&(objectClass=user)(sAMAccountName=%s))'; } $options['bindRequiresDn'] = true; unset($options['username']); $ldap = new LDAP\LDAP($options); try { $ldap->bind($this->_principalName); } catch (LDAP\Exception $zle) { /* Note that if your server actually allows anonymous binds this test will fail. */ $this->assertContains('Failed to retrieve DN', $zle->getMessage()); } }
public function testMismatchDomainBind() { $ldap = new LDAP\LDAP($this->_options); try { $ldap->bind('BOGUS\\doesntmatter', 'doesntmatter'); } catch (LDAP\Exception $zle) { $this->assertTrue($zle->getCode() == LDAP\Exception::LDAP_X_DOMAIN_MISMATCH); } }
/** * @group ZF-8259 */ public function testBoundUserIsReturnedAfterBinding() { $ldap = new LDAP\LDAP($this->_options); $ldap->bind(); $this->assertEquals(TESTS_ZEND_LDAP_USERNAME, $ldap->getBoundUser()); }