You are here

protected function PasswordPolicyUITestCase::createExpirePolicy in Password Policy 7.2

Creates a policy configured for password expiration.

1 call to PasswordPolicyUITestCase::createExpirePolicy()
PasswordPolicyUITestCase::testExpire in ./password_policy.test
Test expire functionality.

File

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

Class

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

Code

protected function createExpirePolicy() {

  // Set up expire policy.
  $password_policy = new stdClass();
  $password_policy->disabled = FALSE;
  $password_policy->api_version = 1;
  $password_policy->name = 'expire';
  $password_policy->export_type = NULL;
  $config = array(
    'alpha_count' => array(
      'alpha_count' => '0',
    ),
    'char_count' => array(
      'char_count' => '0',
    ),
    'consecutive' => array(
      'consecutive_char_count' => '',
    ),
    'int_count' => array(
      'int_count' => '0',
    ),
    'past_passwords' => array(
      'past_passwords' => '0',
    ),
    'special_count' => array(
      'special_count' => '0',
      'special_count_chars' => '`~!@#$%^&*()_+=-|}{"?:><,./;\'\\[]',
    ),
    'username' => array(
      'username' => TRUE,
    ),
    'role' => array(
      'roles' => array(
        2 => 0,
        3 => 0,
      ),
    ),
    'expire' => array(
      'expire_enabled' => TRUE,
      'expire_limit' => '1 second',
      'expire_warning_email_sent' => '',
      '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);
}