You are here

function RelationTestCase::createRelationTypes in Relation 7

Creates a set of standard relation types.

1 call to RelationTestCase::createRelationTypes()
RelationTestCase::setUp in tests/relation.test
Sets up a Drupal site for running functional and integration tests.

File

tests/relation.test, line 102
Tests for Relation module.

Class

RelationTestCase
Relation helper class.

Code

function createRelationTypes() {
  $this->relation_types['symmetric'] = array(
    'relation_type' => 'symmetric',
    'label' => 'symmetric',
    'source_bundles' => array(
      'node:article',
      'node:page',
      'taxonomy_term:*',
      'user:*',
    ),
  );
  $this->relation_types['directional'] = array(
    'relation_type' => 'directional',
    'label' => 'directional',
    'directional' => TRUE,
    'source_bundles' => array(
      'node:*',
    ),
    'target_bundles' => array(
      'node:page',
    ),
  );
  $this->relation_types['directional_entitysame'] = array(
    'relation_type' => 'directional_entitysame',
    'label' => 'directional_entitysame',
    'directional' => TRUE,
    'source_bundles' => array(
      'node:page',
    ),
    'target_bundles' => array(
      'node:page',
    ),
  );
  $this->relation_types['directional_entitydifferent'] = array(
    'relation_type' => 'directional_entitydifferent',
    'label' => 'directional_entitydifferent',
    'directional' => TRUE,
    'source_bundles' => array(
      'user:*',
    ),
    'target_bundles' => array(
      'node:page',
    ),
  );
  $this->relation_types['octopus'] = array(
    'relation_type' => 'octopus',
    'label' => 'octopus',
    'min_arity' => 3,
    'max_arity' => 5,
    'source_bundles' => array(
      'node:article',
      'node:page',
    ),
  );
  $this->relation_types['unary'] = array(
    'relation_type' => 'unary',
    'label' => 'unary',
    'min_arity' => 1,
    'max_arity' => 1,
    'source_bundles' => array(
      'node:page',
    ),
  );
  foreach ($this->relation_types as $relation_type) {
    relation_type_save($relation_type);
  }
}