You are here

public function PasswordPolicyConstraintsTestCase::testAlphaCaseConstraint in Password Policy 7.2

Tests case sensitivity constraint.

File

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

Class

PasswordPolicyConstraintsTestCase
Test case to verify accuracy of each available policy constraint.

Code

public function testAlphaCaseConstraint() {
  $config = array(
    'alpha_case' => array(
      'alpha_case' => TRUE,
    ),
  );
  $policy = $this
    ->createPolicy($config);
  $this
    ->assertFalse($this
    ->checkPolicy($policy, 'A'), 'Case sensivity constraint fails with only upper case letters.', 'Constraint');
  $this
    ->assertFalse($this
    ->checkPolicy($policy, 'a'), 'Case sensivity fails with only lower case letters.', 'Constraint');
  $this
    ->assertTrue($this
    ->checkPolicy($policy, 'Aa'), 'Case sensivity constraint passes with both lower and upper case letters.', 'Constraint');
}