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