You are here

function ContactAttachSettingsFormTestCase::revokePermsAndCheckIfRoleNotListed in Contact Attach 7

Revokes permissions and checks if the role is listed on the settings page.

Parameters

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

array $extra_role_names: (optional) An array of supplementary role names to check for.

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

File

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

Class

ContactAttachSettingsFormTestCase
Tests the Contact Attach settings form.

Code

function revokePermsAndCheckIfRoleNotListed($role, $extra_role_names = array()) {
  user_role_revoke_permissions($role->rid, array(
    'attach files on site-wide contact form',
    'attach files on personal contact forms',
  ));
  $this
    ->drupalGet('admin/config/media/contact_attach');
  $this
    ->assertNoText(t('Settings for the @role role', array(
    '@role' => $role->name,
  )));
  foreach ($extra_role_names as $role_name) {
    $this
      ->assertNoText(t('Settings for the @role role', array(
      '@role' => $role_name,
    )));
  }
}