You are here

protected function AuthassignroleRolePerPathTestCase::createAarPage in Auto Assign Role 7

Same name and namespace in other branches
  1. 7.2 autoassignrole.test \AuthassignroleRolePerPathTestCase::createAarPage()

Helper method for creating a random AutoAssignRole page.

2 calls to AuthassignroleRolePerPathTestCase::createAarPage()
AutoassignroleAdminRolePerPageTestCase::testAutoRolePerPageAdd in ./autoassignrole.test
Test admin functionality of creating a role per path.
AutoassignroleUserCreationRolePerPathTestCase::testUserAutoRegistrationByPath in ./autoassignrole.test
Test the user registration based on a path.

File

./autoassignrole.test, line 615
Creates tests for auto assign role module.

Class

AuthassignroleRolePerPathTestCase

Code

protected function createAarPage($specificRid = NULL) {

  // Check that the user can see the admin add page.
  $this
    ->drupalGet('admin/config/people/autoassignrole/pages/add');

  // Verify that there are roles exposed.
  $role_keys = array_keys($this->roles);
  $this
    ->assertField('roles[' . $role_keys[0] . ']', 'Looking for the autoassignrole_auto_roles checkboxes.');

  // Verify that a checkbox for each of our valid roles shows on the page.
  foreach ($this->roles as $rid => $role) {

    // Only assign the specific rid to this page.
    if (!is_null($specificRid)) {
      if ($specificRid != $rid) {
        continue;
      }
    }
    $edit["roles[{$rid}]"] = $rid;
  }

  // Set the title.
  $this->page_title = $this
    ->randomName();
  $edit['title'] = $this->page_title;

  // Set the path.
  $edit['path'] = $this->page_path = 'test/register/' . $this->page_title;

  // Check each of our roles and submit the form.
  $this
    ->drupalPost('admin/config/people/autoassignrole/pages/add', $edit, t('Add'));

  // Verify the path has been saved.
  $this
    ->assertText('Successfully Created Page ' . $this->page_title, 'Verified that path has been created.');
}