public function PasswordPolicyConstraintsTestCase::testCharCountConstraint in Password Policy 7.2
Tests character count constraint.
File
- ./
password_policy.test, line 220 - Unit tests for Password policy module.
Class
- PasswordPolicyConstraintsTestCase
- Test case to verify accuracy of each available policy constraint.
Code
public function testCharCountConstraint() {
$config = array(
'char_count' => array(
'char_count' => 1,
),
);
$policy = $this
->createPolicy($config);
$this
->assertFalse($this
->checkPolicy($policy, ''), 'Character count constraint fails with less than required characters.', 'Constraint');
$this
->assertTrue($this
->checkPolicy($policy, 'a'), 'Character count constraint passes with minimum required characters.', 'Constraint');
$this
->assertTrue($this
->checkPolicy($policy, 'ab'), 'Character count constraint passes with more than required characters.', 'Constraint');
}