You are here

public function PasswordPolicyConstraintsTestCase::testConsecutiveConstraint in Password Policy 7.2

Tests consecutive count constraint.

File

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

Class

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

Code

public function testConsecutiveConstraint() {
  $config = array(
    'consecutive' => array(
      'consecutive_char_count' => 2,
    ),
  );
  $policy = $this
    ->createPolicy($config);
  $this
    ->assertTrue($this
    ->checkPolicy($policy, 'a'), 'Consecutive character count constraint passes with fewer than maximum consecutive characters.', 'Constraint');
  $this
    ->assertFalse($this
    ->checkPolicy($policy, 'aa'), 'Consecutive character count constraint fails with exact maximum consecutive characters.', 'Constraint');
  $this
    ->assertFalse($this
    ->checkPolicy($policy, 'aaa'), 'Consecutive character count constraint fails with more than maximum consecutive characters.', 'Constraint');
}