You are here

protected function PasswordPolicyExpirationTestCase::createExpirationPolicy in Password Policy 7

Creates expiration policy.

Parameters

int $expiration: Number of days after which password expires.

int $rid: (optional) Role ID to which this policy should apply.

string $warning: (optional) Comma-delimited list of numbers of days before expiration on which expiration warnings are to be sent.

Return value

string Name of created policy.

2 calls to PasswordPolicyExpirationTestCase::createExpirationPolicy()
PasswordPolicyExpirationTestCase::setExpirationPolicy in tests/password_policy_expiration.test
Sets expiration policy.
PasswordPolicyExpirationTestCase::testExpirationConstraint in tests/password_policy_expiration.test
Tests expiration constraint.

File

tests/password_policy_expiration.test, line 538
Tests for Password policy module expiration functionality.

Class

PasswordPolicyExpirationTestCase
Tests of password expiration.

Code

protected function createExpirationPolicy($expiration, $rid = DRUPAL_AUTHENTICATED_RID, $warning = '') {
  $policy_name = $this
    ->randomName();
  $edit = array(
    'name' => $policy_name,
    'expiration' => $expiration,
    'warning' => $warning,
    "roles[{$rid}]" => $rid,
  );
  $this
    ->drupalPost('admin/config/people/password_policy/add', $edit, t('Create'));
  $created_text = "Policy {$policy_name} has been created.";
  $this
    ->assertText($created_text, $created_text);
  return $policy_name;
}