You are here

protected function PasswordPolicyUITestCase::createStrongPolicy in Password Policy 7.2

Creates a strong policy.

2 calls to PasswordPolicyUITestCase::createStrongPolicy()
PasswordPolicyUITestCase::testPasswordSet in ./password_policy.test
Tests setting passwords.
PasswordPolicyUITestCase::testRegistration in ./password_policy.test
Tests password policy enforcement on registration.

File

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

Class

PasswordPolicyUITestCase
Test case to verify accuracy of each available policy condition.

Code

protected function createStrongPolicy() {

  // Set up strong policy.
  $password_policy = new stdClass();
  $password_policy->disabled = FALSE;
  $password_policy->api_version = 1;
  $password_policy->name = 'strong';
  $password_policy->export_type = NULL;
  $config = array(
    'alpha_count' => array(
      'alpha_count' => '1',
    ),
    'char_count' => array(
      'char_count' => '8',
    ),
    'consecutive' => array(
      'consecutive_char_count' => '',
    ),
    'int_count' => array(
      'int_count' => '1',
    ),
    'past_passwords' => array(
      'past_passwords' => '2',
    ),
    'special_count' => array(
      'special_count' => '0',
      'special_count_chars' => '`~!@#$%^&*()_+=-|}{"?:><,./;\'\\[]',
    ),
    'username' => array(
      'username' => TRUE,
    ),
    'role' => array(
      'roles' => array(
        2 => 0,
        3 => 0,
      ),
    ),
    'expire' => array(
      'expire_limit' => '0',
      'expire_warning_email_sent' => '-14 days',
      'expire_warning_email_message' => '',
      'expire_warning_email_subject' => '[user:name] you password on [site:name] shall expire in [password_expiration_date:interval]',
    ),
  );
  $password_policy->config = serialize($config);
  ctools_export_crud_save('password_policy', $password_policy);
}