function OgPermissionsTestCase::testGrantRolesTwiceForPendingUsers in Organic groups 7.2
File
- ./og.test, line 807
Class
- OgPermissionsTestCase
Code
function testGrantRolesTwiceForPendingUsers() {
$user1 = $this
->drupalCreateUser();
$entity = entity_create('entity_test', array(
'name' => 'main',
'uid' => $user1->uid,
));
$wrapper = entity_metadata_wrapper('entity_test', $entity);
$wrapper->{OG_GROUP_FIELD}
->set(1);
$wrapper
->save();
$og_roles = og_roles('entity_test', 'main');
$values = array(
'entity_type' => 'user',
'entity' => $user1,
'state' => OG_STATE_PENDING,
);
$rid = array_search(OG_ADMINISTRATOR_ROLE, $og_roles);
og_group('entity_test', $entity->pid, $values);
og_role_grant('entity_test', $entity->pid, $user1->uid, $rid);
og_role_grant('entity_test', $entity->pid, $user1->uid, $rid);
$this
->pass('Granting a role twice should not throw an exception.');
}