Example #1
0
 /**
  * Test blocking system
  *
  * @return void
  */
 public function testDbLoginSuspended()
 {
     $this->authAdapter->setIdentity('demo')->setCredential(md5('emod'));
     $this->authAdapter->setLockedUntilColumn($this->lockeduntilColumn);
     $this->authAdapter->setLockSeconds(30);
     $this->assertNull($this->authAdapter->getLockedUntil());
     $this->assertEquals('30', $this->authAdapter->getLockSeconds());
     $this->assertEquals($this->getAccountLockDate($this->lockeduntilColumn), '0000-00-00 00:00:00');
     $authResponse = $this->auth->authenticate($this->authAdapter);
     $this->assertNotEquals($this->getAccountLockDate($this->lockeduntilColumn), '0000-00-00 00:00:00');
     $this->assertFalse($authResponse->isValid());
     $this->auth = Enlight_Components_Auth::getInstance();
     $this->authAdapter = new Enlight_Components_Auth_Adapter_DbTable($this->db, 'test_auth', 'username', 'password');
     $this->authAdapter->setIdentity('demo')->setCredential(md5('demo'));
     $this->authAdapter->setLockedUntilColumn($this->lockeduntilColumn);
     $authResponse = $this->auth->authenticate($this->authAdapter);
     $this->assertTrue($authResponse->isValid());
 }