You are here

public function OgSubgroupHelperFunctionUnitTestCase::testOgSubgroupHelperFunctions in Subgroups for Organic groups 7.2

Tests drupal_array_diff_assoc_recursive().

File

./og_subgroups.test, line 28
Testing functions for OG Subgroups.

Class

OgSubgroupHelperFunctionUnitTestCase
@file Testing functions for OG Subgroups.

Code

public function testOgSubgroupHelperFunctions() {
  drupal_load('module', 'og_subgroups');
  $array_one = array(
    'entity_type_1' => array(
      0,
      1,
      2,
      3,
    ),
    'entity_type_2' => array(
      0,
      1,
      2,
    ),
  );
  $array_two = array(
    'entity_type_1' => array(
      0,
      1,
      2,
    ),
    'entity_type_3' => array(
      0,
      1,
      2,
    ),
  );
  $intersect = array(
    'entity_type_1' => array(
      0,
      1,
      2,
    ),
  );
  $diff = array(
    'entity_type_1' => array(
      3 => 3,
    ),
    'entity_type_2' => array(
      0,
      1,
      2,
    ),
  );
  $merge = array(
    'entity_type_1' => array(
      0,
      1,
      2,
      3,
    ),
    'entity_type_2' => array(
      0,
      1,
      2,
    ),
    'entity_type_3' => array(
      0,
      1,
      2,
    ),
  );
  $this
    ->assertIdentical(og_subgroups_intersect_groups($array_one, $array_two), $intersect);
  $this
    ->assertIdentical(og_subgroups_diff_groups($array_one, $array_two), $diff);
  $this
    ->assertIdentical(og_subgroups_merge_groups($array_one, $array_two), $merge);
}