You are here

public function PasswordPolicyConstraintsTestCase::testUsernameConstraint in Password Policy 7.2

Tests username constraint.

File

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

Class

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

Code

public function testUsernameConstraint() {
  $config = array(
    'username' => array(
      'username' => TRUE,
    ),
  );
  $policy = $this
    ->createPolicy($config);
  $this
    ->assertFalse($this
    ->checkPolicy($policy, $this->account->name), 'Username constraint fails with username present.', 'Constraint');
  $this
    ->assertTrue($this
    ->checkPolicy($policy, ''), 'Username constraint passes with username absent.', 'Constraint');
}