You are here

protected function OpenAtriumAccessBaseTestCase::oaCreateGroupWithUser in Open Atrium Core 7.2

Creates an Open Atrium Group with a new user in an optional Space.

Parameters

array $info: An associative array with information about the node which will eventually get passed to node_save().

array $permissions: An array containing all the permissions this user should have.

object $space: (Optional) A Drupal node object representing the Space this user should be created in.

Return value

array An associative array with two keys:

  • group: (object) A Drupal node object representing the new Group node.
  • user: (object) A Drupal user object representing the new user.
6 calls to OpenAtriumAccessBaseTestCase::oaCreateGroupWithUser()
OpenAtriumAccessTestCase::testCleanupPermissions in modules/oa_access/tests/oa_access.test
OpenAtriumAccessTestCase::testCombinedGroupPermissions in modules/oa_access/tests/oa_access.test
OpenAtriumAccessTestCase::testGetSetGroupPermissions in modules/oa_access/tests/oa_access.test
OpenAtriumAccessTestCase::testGroupAccess in modules/oa_access/tests/oa_access.test
OpenAtriumAccessTestCase::testGroupAdminPage in modules/oa_access/tests/oa_access.test

... See full list

File

modules/oa_access/tests/oa_access.test, line 122
Functional tests for the Open Atrium Access module.

Class

OpenAtriumAccessBaseTestCase

Code

protected function oaCreateGroupWithUser(array $info, array $permissions, $space = NULL) {
  $info += array(
    'type' => 'oa_group',
    'title' => 'Group',
  );
  $group = $this
    ->oaCreateNode($info);
  $account = $this
    ->oaCreateUser($permissions, $space);

  // Add the user to the group.
  og_group('node', $group->nid, array(
    'entity type' => 'user',
    'entity' => $account,
    'membership type' => OG_MEMBERSHIP_TYPE_DEFAULT,
  ));
  return array(
    'group' => $group,
    'user' => $account,
  );
}