You are here

public function PasswordPolicyConstraintsTestCase::testAlphaCountConstraint in Password Policy 7.2

Tests letter count constraint.

File

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

Class

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

Code

public function testAlphaCountConstraint() {
  $config = array(
    'alpha_count' => array(
      'alpha_count' => 1,
    ),
  );
  $policy = $this
    ->createPolicy($config);
  $this
    ->assertFalse($this
    ->checkPolicy($policy, ''), 'Letter count constraint fails with less than required letters.', 'Constraint');
  $this
    ->assertTrue($this
    ->checkPolicy($policy, 'a'), 'Letter count constraint passes with minimum required letters.', 'Constraint');
  $this
    ->assertTrue($this
    ->checkPolicy($policy, 'a1'), 'Letter count constraint passes with more than required letters.', 'Constraint');
}