You are here

function RelationTestCase::createRelationDirectional in Relation 7

Creates a Directional relation.

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

File

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

Class

RelationTestCase
Relation helper class.

Code

function createRelationDirectional() {

  // Article 1 --> Page 3
  $this->endpoints[1]['entity_id'] = $this->node3->nid;
  $this->endpoints[1]['r_index'] = 1;
  $this->relation_type_directional = $this->relation_types['directional']['relation_type'];
  $this->rid_directional = $this
    ->saveRelation($this->relation_type_directional, $this->endpoints);

  // Page 3 --> Page 4
  $this->endpoints[0]['entity_id'] = $this->node3->nid;
  $this->endpoints[1]['entity_id'] = $this->node4->nid;
  $this
    ->saveRelation($this->relation_type_directional, $this->endpoints);

  // Page 3 --> Page 4
  $this->endpoints_entitysame[1]['r_index'] = 1;
  $this->relation_type_directional_entitysame = $this->relation_types['directional_entitysame']['relation_type'];
  $this
    ->saveRelation($this->relation_type_directional_entitysame, $this->endpoints_entitysame);

  // Page 3 --> Page 5
  $this->endpoints_entitysame[1]['entity_id'] = $this->node5->nid;
  $this
    ->saveRelation($this->relation_type_directional_entitysame, $this->endpoints_entitysame);

  // Page 4 --> Page 3
  $this->endpoints_entitysame[0]['entity_id'] = $this->node4->nid;
  $this->endpoints_entitysame[1]['entity_id'] = $this->node3->nid;
  $this
    ->saveRelation($this->relation_type_directional_entitysame, $this->endpoints_entitysame);

  // User 1 --> Page 3
  $this->endpoints_entitydifferent[1]['r_index'] = 1;
  $this->relation_type_directional_entitydifferent = $this->relation_types['directional_entitydifferent']['relation_type'];
  $this
    ->saveRelation($this->relation_type_directional_entitydifferent, $this->endpoints_entitydifferent);

  // User 1 --> Page 4
  $this->endpoints_entitydifferent[1]['entity_id'] = $this->node4->nid;
  $this
    ->saveRelation($this->relation_type_directional_entitydifferent, $this->endpoints_entitydifferent);
}