You are here

oa_sectionsAccess.test in Open Atrium Core 7.2

Tests permission inheritance for oa_subspaces

File

modules/oa_sections/tests/oa_sectionsAccess.test
View source
<?php

/**
 * @file
 * Tests permission inheritance for oa_subspaces
 */
class oa_sectionsAccess extends oa_sectionsAccessBase {
  static function getInfo() {
    return array(
      'name' => 'OA Section Permission test (fast)',
      'description' => 'Test that can access sections correctly',
      'group' => 'OA - Sections',
    );
  }
  function test_oa_sectionsAccess() {
    extract($this
      ->createOaSpaceAndUsers());
    $team = $this
      ->createNodeInOaSpace($space, array(
      'type' => 'oa_team',
      'uid' => $space_admin->uid,
      'field_oa_team_users' => array(
        LANGUAGE_NONE => array(
          array(
            'target_id' => $space_member->uid,
          ),
          array(
            'target_id' => $space_admin->uid,
          ),
        ),
      ),
    ));
    $space_member_2 = $this
      ->createUserInOaSpace($space);
    $non_member = $this
      ->drupalCreateUser();

    // Group that just $space_member is part of.
    $group = $this
      ->drupalCreateNode(array(
      'type' => 'oa_group',
    ));
    og_group('node', $group, array(
      'entity' => $space_member,
    ));

    // Test a public space.
    $this
      ->oaTestOaSectionAccess('a public space', $space, $space_admin, $space_member, $space_member_2, $non_member, $group, $team);

    // Test a private space.
    $space_private = $this
      ->drupalCreateNode(array(
      'type' => 'oa_space',
      'uid' => $space_admin->uid,
      'group_access' => array(
        LANGUAGE_NONE => array(
          array(
            'value' => 1,
          ),
        ),
      ),
    ));
    og_group('node', $space_private, array(
      'entity' => $space_member,
    ));
    og_group('node', $space_private, array(
      'entity' => $space_member_2,
    ));
    $this
      ->oaTestOaSectionAccess('a private space', $space_private, $space_admin, $space_member, $space_member_2, $non_member, $group);
  }

}

Classes

Namesort descending Description
oa_sectionsAccess @file Tests permission inheritance for oa_subspaces