function PasswordPolicyTestCase::testDigitConstraint in Password Policy 6
Same name and namespace in other branches
- 7 tests/password_policy.test \PasswordPolicyTestCase::testDigitConstraint()
File
- tests/
password_policy.test, line 70 - Unit tests for Password policy module.
Class
- PasswordPolicyTestCase
- @file Unit tests for Password policy module.
Code
function testDigitConstraint() {
module_load_include('inc', 'password_policy', 'constraints/constraint_digit');
$constraint = 2;
$uid = 0;
$pass = '1ab';
$result = password_policy_constraint_digit_validate($pass, $constraint, $uid);
$this
->assertFalse($result, 'One digit in the digit constraint with param 2');
$pass = '12a';
$result = password_policy_constraint_digit_validate($pass, $constraint, $uid);
$this
->assertTrue($result, 'Two digits in the digit constraint with param 2');
$pass = '123';
$result = password_policy_constraint_digit_validate($pass, $constraint, $uid);
$this
->assertTrue($result, 'Three digits in the digit constraint with param 2');
}