You are here

function ContactAttachSettingsFormTestCase::checkPermittedRoleOnSettingsPage in Contact Attach 7

Checks if the role is listed on the settings page when having permissions.

Also tests submitting settings for the role.

Parameters

int $rid: The role ID of the role to be checked.

bool $grant_perms: (optional) TRUE if permissions should be granted; FALSE otherwise.

Return value

object A fully-loaded role object as returned by user_role_load().

1 call to ContactAttachSettingsFormTestCase::checkPermittedRoleOnSettingsPage()
ContactAttachSettingsFormTestCase::testContactAttachSettingsForm in ./contact_attach.test
Tests the module settings form with granted permissions for various roles.

File

./contact_attach.test, line 105
Tests for the Contact Attach module.

Class

ContactAttachSettingsFormTestCase
Tests the Contact Attach settings form.

Code

function checkPermittedRoleOnSettingsPage($rid, $grant_perms = TRUE) {
  if ($grant_perms) {
    user_role_grant_permissions($rid, array(
      'attach files on site-wide contact form',
      'attach files on personal contact forms',
    ));
  }
  $this
    ->drupalGet('admin/config/media/contact_attach');
  $role = user_role_load($rid);
  $this
    ->runSettingsFormTestForRole($role);
  return $role;
}