You are here

protected function PasswordPolicyAuthmapTestCase::createTestPolicy in Password Policy 7

Creates test policy.

1 call to PasswordPolicyAuthmapTestCase::createTestPolicy()
PasswordPolicyAuthmapTestCase::setTestPolicy in tests/password_policy_authmap.test
Sets test policy.

File

tests/password_policy_authmap.test, line 126
Functional tests for excluding authentication modules from policies.

Class

PasswordPolicyAuthmapTestCase
Tests of basic Password Policy constraints.

Code

protected function createTestPolicy() {
  $policy_name = $this
    ->randomName();
  $rid = DRUPAL_AUTHENTICATED_RID;
  $edit = array(
    'name' => $policy_name,
    "roles[{$rid}]" => $rid,
    'excluded_authentication_modules[auth_module_one]' => 'auth_module_one',
    'constraint_length' => 4,
  );
  $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;
}