public function PasswordPolicyTestCase::testLowercaseConstraint in Password Policy 7
Same name and namespace in other branches
- 6 tests/password_policy.test \PasswordPolicyTestCase::testLowercaseConstraint()
Test lowercase constraint.
File
- tests/
password_policy.test, line 52 - Functional tests for Password policy module.
Class
- PasswordPolicyTestCase
- Tests of basic Password Policy constraints.
Code
public function testLowercaseConstraint() {
module_load_include('inc', 'password_policy', 'constraints/constraint_lowercase');
$constraint = 2;
$user = $this
->drupalCreateUser();
$pass = 'Abc';
$result = password_policy_constraint_lowercase_validate($pass, $constraint, $user);
$this
->assertTrue($result, 'One uppercase letter in the lowercase constraint with param 2');
$pass = 'ABc';
$result = password_policy_constraint_lowercase_validate($pass, $constraint, $user);
$this
->assertFalse($result, 'Two uppercase letters in the lowercase constraint with param 2');
$pass = 'ABC';
$result = password_policy_constraint_lowercase_validate($pass, $constraint, $user);
$this
->assertFalse($result, 'Three uppercase letters in the lowercase constraint with param 2');
}