You are here

function PasswordPolicyTestCase::testLowercaseConstraint in Password Policy 6

Same name and namespace in other branches
  1. 7 tests/password_policy.test \PasswordPolicyTestCase::testLowercaseConstraint()

File

tests/password_policy.test, line 40
Unit tests for Password policy module.

Class

PasswordPolicyTestCase
@file Unit tests for Password policy module.

Code

function testLowercaseConstraint() {
  module_load_include('inc', 'password_policy', 'constraints/constraint_lowercase');
  $constraint = 2;
  $uid = 0;
  $pass = 'Abc';
  $result = password_policy_constraint_lowercase_validate($pass, $constraint, $uid);
  $this
    ->assertTrue($result, 'One uppercase letter in the lowercase constraint with param 2');
  $pass = 'ABc';
  $result = password_policy_constraint_lowercase_validate($pass, $constraint, $uid);
  $this
    ->assertFalse($result, 'Two uppercase letters in the lowercase constraint with param 2');
  $pass = 'ABC';
  $result = password_policy_constraint_lowercase_validate($pass, $constraint, $uid);
  $this
    ->assertFalse($result, 'Three uppercase letters in the lowercase constraint with param 2');
}