function PasswordPolicyTestCase::testLetterConstraint in Password Policy 6
Same name and namespace in other branches
- 7 tests/password_policy.test \PasswordPolicyTestCase::testLetterConstraint()
File
- tests/
password_policy.test, line 55 - Unit tests for Password policy module.
Class
- PasswordPolicyTestCase
- @file Unit tests for Password policy module.
Code
function testLetterConstraint() {
module_load_include('inc', 'password_policy', 'constraints/constraint_letter');
$constraint = 2;
$uid = 0;
$pass = 'a12';
$result = password_policy_constraint_letter_validate($pass, $constraint, $uid);
$this
->assertFalse($result, 'One lowercase letter in the letter constraint with param 2');
$pass = 'aB1';
$result = password_policy_constraint_letter_validate($pass, $constraint, $uid);
$this
->assertTrue($result, 'One lowercase and one uppercase letter in the letter constraint with param 2');
$pass = 'abC';
$result = password_policy_constraint_letter_validate($pass, $constraint, $uid);
$this
->assertTrue($result, 'Two lowercase and one uppercase letter in the letter constraint with param 2');
}