function CommentNotifyTestCase::setPermission in Comment Notify 6
Set permission.
Parameters
string $role User role to set permissions for.:
array $permissions Key-value array of permissions to set.:
1 call to CommentNotifyTestCase::setPermission()
- CommentNotifyTestCase::testCommentNotifyAnonymousUserFunctionalTest in ./
comment_notify.test - Test various behaviors for anonymous users.
File
- ./
comment_notify.test, line 93
Class
Code
function setPermission($role, $permissions) {
// Get role id (rid) for specified role.
$rid = db_result(db_query("SELECT rid FROM {role} WHERE name = '%s'", array(
'%s' => $role,
)));
if ($rid === FALSE) {
$this
->fail(t(' [permission] Role "' . $role . '" not found.'));
}
// Create edit array from permission.
$edit = array();
foreach ($permissions as $name => $value) {
$edit[$rid . '[' . $name . ']'] = $value;
}
$this
->drupalPost('admin/user/permissions', $edit, t('Save permissions'));
$this
->assertText(t('The changes have been saved.'), t(' [permission] Saved changes.'));
}