示例#1
0
 /**
  * Ensures that the adapter throws an exception when a required option is missing
  * 
  * @return void
  */
 public function testOptionRequiredException()
 {
     $options = array('realm' => 'Some Realm', 'username' => 'someUser', 'password' => 'somePassword');
     try {
         Zend_Auth_Digest_Adapter::staticAuthenticate($options);
         $this->fail('Expected Zend_Auth_Digest_Exception not thrown upon authentication attempt ' . 'missing a required option');
     } catch (Zend_Auth_Digest_Exception $e) {
         $this->assertContains('required', $e->getMessage());
     }
 }
示例#2
0
 /**
  * Ensures expected behavior upon realm not found for existing user
  *
  * @return void
  */
 public function testUserExistsRealmNonexistent()
 {
     $options = array('filename' => "{$this->_filesPath}/.htdigest.1", 'realm' => 'Nonexistent Realm', 'username' => 'someUser', 'password' => 'somePassword');
     $token = Zend_Auth_Digest_Adapter::staticAuthenticate($options);
     $this->assertFalse($token->isValid());
     $this->assertContains('combination not found', $token->getMessage());
     $identity = $token->getIdentity();
     $this->assertTrue($identity['realm'] === $options['realm']);
     $this->assertTrue($identity['username'] === $options['username']);
 }