/** * Ensures that the authenticate method works as expected * * @return void */ public function testAuthenticate() { $options1 = array('realm' => 'Some Realm', 'username' => 'someUser', 'password' => 'somePassword'); $auth1 = new Zend_Auth_Digest_Adapter("{$this->_filesPath}/.htdigest.1"); $token1 = $auth1->authenticate($options1); $this->assertTrue($token1->isValid()); $identity1 = $token1->getIdentity(); $this->assertTrue($identity1['realm'] === $options1['realm']); $this->assertTrue($identity1['username'] === $options1['username']); $options2 = array('realm' => 'Another Realm', 'username' => 'anotherUser', 'password' => 'anotherPassword'); $auth2 = new Zend_Auth_Digest_Adapter("{$this->_filesPath}/.htdigest.2"); $token2 = $auth2->authenticate($options2); $this->assertTrue($token2->isValid()); $identity2 = $token2->getIdentity(); $this->assertTrue($identity2['realm'] === $options2['realm']); $this->assertTrue($identity2['username'] === $options2['username']); }