/** * Test lockout on multiple failed authentications */ public function testLockout() { // if not enabled, do not run remaining tests if (!$this->esig_enabled) { return null; } // doesn't matter what we call here, just need 3 failed attempts // NOTE the number of failed attempts must be changed if there is // a change in the electronic signature definition of the // maximum number of attempts before lockout $result = $this->ktapi->create_folder(1, 'New test api folder'); $this->assertEqual($result['status_code'], 1); $result = $this->ktapi->create_folder(1, 'New test api folder'); $this->assertEqual($result['status_code'], 1); $result = $this->ktapi->create_folder(1, 'New test api folder'); $this->assertEqual($result['status_code'], 1); // fourth attempt to check lockout message returned $result = $this->ktapi->create_folder(1, 'New test api folder'); $this->assertEqual($result['status_code'], 1); $eSignature = new ESignature('api'); $this->assertTrue($result['message'] == $eSignature->getLockMsg()); // force reset of the lockout so that remaining tests can run :) unset($_SESSION['esignature_attempts']); unset($_SESSION['esignature_lock']); }