You are here

public function PasswordPolicyConstraintsTestCase::testSpecialCharCountConstraint in Password Policy 7.2

Tests special character count constraint.

File

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

Class

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

Code

public function testSpecialCharCountConstraint() {
  $config = array(
    'special_count' => array(
      'special_count' => 1,
    ),
  );
  $policy = $this
    ->createPolicy($config);
  $this
    ->assertFalse($this
    ->checkPolicy($policy, 'a'), 'Special character count constraint fails with less than required special characters.', 'Constraint');
  $this
    ->assertTrue($this
    ->checkPolicy($policy, 'a$'), 'Special character count constraint passes with minimum required special characters.', 'Constraint');
  $this
    ->assertTrue($this
    ->checkPolicy($policy, '&a$'), 'Special character count constraint passes with more than required special characters.', 'Constraint');
}