public function testCanonAuth() { /* This test authenticates with each of the account name forms * (uname, uname@example.com, EXAMPLE\uname) AND it does so with * the accountCanonicalForm set to each of the account name forms * (e.g. authenticate with uname@example.com but getIdentity() returns * EXAMPLE\uname). A total of 9 authentications are performed. */ foreach ($this->names as $form => $formName) { $options = $this->options; $options['accountCanonicalForm'] = $form; $adapter = new Adapter\Ldap(array($options)); $adapter->setPassword(TESTS_ZEND_LDAP_ALT_PASSWORD); foreach ($this->names as $username) { $adapter->setUsername($username); $result = $adapter->authenticate(); $this->assertTrue($result instanceof Authentication\Result); $this->assertTrue($result->isValid()); $this->assertTrue($result->getCode() == Authentication\Result::SUCCESS); $this->assertTrue($result->getIdentity() === $formName); } } }
public function testSetAndGetUsername() { $usernameExpected = 'someUsername'; $usernameActual = $this->adapter->setUsername($usernameExpected)->getUsername(); $this->assertSame($usernameExpected, $usernameActual); }