diff --git a/tests/relation.test b/tests/relation.test
index 6e21afe..1dfd860 100644
--- a/tests/relation.test
+++ b/tests/relation.test
@@ -35,6 +35,7 @@ class RelationTestCase extends DrupalWebTestCase {
 
     // Defines entities.
     $this->createRelationNodes();
+    $this->createRelationUsers();
 
     // Defines relation types.
     $this->createRelationTypes();
@@ -59,6 +60,10 @@ class RelationTestCase extends DrupalWebTestCase {
     $this->node5 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 0));
   }
 
+  function createRelationUsers() {
+    $this->user1 = $this->drupalCreateUser();
+  }
+
   /**
    * Creates end points.
    */
@@ -73,6 +78,14 @@ class RelationTestCase extends DrupalWebTestCase {
       array('entity_type' => 'node', 'entity_id' => $this->node3->nid),
       array('entity_type' => 'node', 'entity_id' => $this->node4->nid),
     );
+    $this->endpoints_entitysame = array(
+      array('entity_type' => 'node', 'entity_id' => $this->node3->nid),
+      array('entity_type' => 'node', 'entity_id' => $this->node4->nid),
+    );
+    $this->endpoints_entitydifferent = array(
+      array('entity_type' => 'user', 'entity_id' => $this->user1->uid),
+      array('entity_type' => 'node', 'entity_id' => $this->node3->nid),
+    );
   }
 
   /**
@@ -91,6 +104,20 @@ class RelationTestCase extends DrupalWebTestCase {
       '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',
@@ -121,9 +148,30 @@ class RelationTestCase extends DrupalWebTestCase {
     $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);
   }
 
   /**
@@ -184,18 +232,17 @@ class RelationAPITestCase extends RelationTestCase {
     $count = count($relations);
     $this->assertEqual($count, 3);
 
-    // Get number of relations for node 4, should return 3 relations, 1 is in
-    // symmetrical, 3 and 4 is in octopus.
+    // Get number of relations for node 4, should return 6 relations.
     $count = relation_query('node', $this->node4->nid)
       ->count()
       ->execute();
-    $this->assertEqual($count, 3);
+    $this->assertEqual($count, 6);
 
-    // Get number of relations for node 5, should return 0 relations.
+    // Get number of relations for node 5, should return 1 relation.
     $count = relation_query('node', $this->node5->nid)
       ->count()
       ->execute();
-    $this->assertFalse($count);
+    $this->assertEqual($count, 1);
 
     // Get relations between entities 2 and 5 (none).
     $count = relation_query('node', $this->node2->nid)
@@ -204,11 +251,11 @@ class RelationAPITestCase extends RelationTestCase {
       ->execute();
     $this->assertFalse($count);
 
-    // Get directed relations for node 3 using index, should return only one
-    // relation. The other node 3 relation has an r_index 0.
+    // Get directed relations for node 3 using index, should return 2 relations.
+    // The other node 3 relation has an r_index 0.
     $relations = relation_query('node', $this->node3->nid, 1)
       ->execute();
-    $this->assertEqual(count($relations), 1);
+    $this->assertEqual(count($relations), 3);
     $this->assertTrue(isset($relations[$this->rid_directional]), 'Got the correct directional relation for nid=3.');
 
     // Get relations between entities 2 and 3 (octopus).
@@ -257,12 +304,12 @@ class RelationAPITestCase extends RelationTestCase {
    */
   function testRelationTypes() {
     // Symmetric.
-    $related = relation_get_related_entity('node', $this->node4->nid);
-    $this->assertEqual($this->node1->nid, $related->nid);
+    $related = relation_get_related_entity('node', $this->node1->nid);
+    $this->assertEqual($this->node4->nid, $related->nid);
 
     // Confirm this works once the related entity has been cached.
-    $related = relation_get_related_entity('node', $this->node4->nid);
-    $this->assertEqual($this->node1->nid, $related->nid);
+    $related = relation_get_related_entity('node', $this->node1->nid);
+    $this->assertEqual($this->node4->nid, $related->nid);
 
     // Directional.
     // From Parent to Grandparent.
@@ -288,9 +335,11 @@ class RelationAPITestCase extends RelationTestCase {
     foreach ($this->relation_types as $value) {
       $relation_type = $value['relation_type'];
       $endpoints = isset($value['min_arity']) ? $this->endpoints_4 : $this->endpoints;
+      if ($relation_type == 'directional_entitydifferent') {
+        $endpoints = $this->endpoints_entitydifferent;
+      }
       $relation = relation_create($relation_type, $endpoints);
       $rid = relation_save($relation);
-
       $this->assertTrue($rid, 'Relation created.');
       $count = count($relation->endpoints[LANGUAGE_NONE]);
       $this->assertEqual($count, count($endpoints));
@@ -299,8 +348,8 @@ class RelationAPITestCase extends RelationTestCase {
       foreach ($relation->endpoints[LANGUAGE_NONE] as $endpoint) {
         $need_ids[$endpoint['entity_id']] = TRUE;
       }
-      foreach ($relation->endpoints[LANGUAGE_NONE] as $endpoint) {
-        $this->assertEqual($endpoint['entity_type'], 'node', 'The entity type is node: ' . $endpoint['entity_type']);
+      foreach ($relation->endpoints[LANGUAGE_NONE] as $delta => $endpoint) {
+        $this->assertEqual($endpoint['entity_type'], $endpoints[$delta]['entity_type'], 'The entity type is ' . $endpoints[$delta]['entity_type'] . ': ' . $endpoint['entity_type']);
         $this->assertTrue(isset($need_ids[$endpoint['entity_id']]), 'The entity ID is correct: ' . $need_ids[$endpoint['entity_id']]);
         unset($need_ids[$endpoint['entity_id']]);
       }
diff --git a/tests/relation.views.test b/tests/relation.views.test
index 48fd1d3..2352dbf 100644
--- a/tests/relation.views.test
+++ b/tests/relation.views.test
@@ -67,9 +67,19 @@ class RelationViewsTestCase extends RelationTestCase {
           $this->assertEqual($result->rid, 2);
           $this->assertEqual($result->relation_arity, 2);
           break;
+        case 'directional_entitysame':
+          // Relation #4 is of type directional_entitysame and has 2 endpoints.
+          $this->assertEqual($result->rid, 4);
+          $this->assertEqual($result->relation_arity, 2);
+          break;
+        case 'directional_entitydifferent':
+          // Relation #7 is of type directional_entitydifferent and has 2 endpoints.
+          $this->assertEqual($result->rid, 7);
+          $this->assertEqual($result->relation_arity, 2);
+          break;
         case 'octopus':
           // Relation #4 is of type octopus and has 4 endpoints.
-          $this->assertEqual($result->rid, 4);
+          $this->assertEqual($result->rid, 9);
           $this->assertEqual($result->relation_arity, 4);
           break;
       }
@@ -152,5 +162,209 @@ class RelationViewsTestCase extends RelationTestCase {
           break;
       }
     }
+
+    // Forward directional to source, to target and to both with the same entities types.
+    for ($r_index = -1; $r_index < 2; $r_index++) {
+      $view = new view;
+      $view->base_table = 'node';
+      $handler = $view->new_display('default');
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['id'] = 'relation_directional_entitysame_node';
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['table'] = 'node';
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['field'] = 'relation_directional_entitysame_node';
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['required'] = 1;
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['r_index'] = $r_index;
+      $handler->display->display_options['fields']['nid']['id'] = 'nid';
+      $handler->display->display_options['fields']['nid']['table'] = 'node';
+      $handler->display->display_options['fields']['nid']['field'] = 'nid';
+      $handler->display->display_options['fields']['nid']['relationship'] = 'relation_directional_entitysame_node';
+      $handler->display->display_options['arguments']['nid']['id'] = 'nid';
+      $handler->display->display_options['arguments']['nid']['table'] = 'node';
+      $handler->display->display_options['arguments']['nid']['field'] = 'nid';
+      $view->set_arguments(array($this->node3->nid));
+      $view->execute();
+
+      switch ($r_index) {
+        case -1:
+          // Directional, both ways.
+          $this->assertEqual(count($view->result), 3);
+          $matches = array($this->node4->nid => TRUE, $this->node4->nid => TRUE, $this->node5->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->node_node_nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+        case 0:
+          // Source. This finds the p3->p4 and p3->p5 relations.
+          $this->assertEqual(count($view->result), 2);
+          $matches = array($this->node4->nid => TRUE, $this->node5->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->node_node_nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+        case 1:
+          // Target. This finds the p4->p3 relation.
+          $this->assertEqual(count($view->result), 1);
+          $matches = array($this->node4->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->node_node_nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+      }
+    }
+
+    // Reverse directional to source, to target and to both with the same entities types.
+    for ($r_index = -1; $r_index < 2; $r_index++) {
+      $view = new view;
+      $view->base_table = 'node';
+      $handler = $view->new_display('default');
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['id'] = 'relation_directional_entitysame_node';
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['table'] = 'node';
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['field'] = 'relation_directional_entitysame_node';
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['required'] = 1;
+      $handler->display->display_options['relationships']['relation_directional_entitysame_node']['r_index'] = $r_index;
+      $handler->display->display_options['fields']['nid']['id'] = 'nid';
+      $handler->display->display_options['fields']['nid']['table'] = 'node';
+      $handler->display->display_options['fields']['nid']['field'] = 'nid';
+      $handler->display->display_options['arguments']['nid']['id'] = 'nid';
+      $handler->display->display_options['arguments']['nid']['table'] = 'node';
+      $handler->display->display_options['arguments']['nid']['field'] = 'nid';
+      $handler->display->display_options['arguments']['nid']['relationship'] = 'relation_directional_entitysame_node';
+      $view->set_arguments(array($this->node3->nid));
+      $view->execute();
+
+      switch ($r_index) {
+        case -1:
+          // Directional, both ways.
+          $this->assertEqual(count($view->result), 3);
+          $matches = array($this->node4->nid => TRUE, $this->node5->nid => TRUE, $this->node4->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+        case 0:
+          // Reverse source. This finds the p4->p3 relation.
+          $this->assertEqual(count($view->result), 1);
+          $matches = array($this->node4->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+        case 1:
+          // Reverse target. This finds the p3->p4 and p3->p5 relations.
+          $this->assertEqual(count($view->result), 2);
+          $matches = array($this->node4->nid => TRUE, $this->node5->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+      }
+    }
+
+    // Forward directional to source, to target and to both with different entities types.
+    for ($r_index = -1; $r_index < 2; $r_index++) {
+      $view = new view;
+      $view->base_table = 'users';
+      $handler = $view->new_display('default');
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_node']['id'] = 'relation_directional_entitydifferent_node';
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_node']['table'] = 'users';
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_node']['field'] = 'relation_directional_entitydifferent_node';
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_node']['required'] = 1;
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_node']['r_index'] = $r_index;
+      $handler->display->display_options['fields']['nid']['id'] = 'nid';
+      $handler->display->display_options['fields']['nid']['table'] = 'node';
+      $handler->display->display_options['fields']['nid']['field'] = 'nid';
+      $handler->display->display_options['fields']['nid']['relationship'] = 'relation_directional_entitydifferent_node';
+      $handler->display->display_options['arguments']['uid']['id'] = 'uid';
+      $handler->display->display_options['arguments']['uid']['table'] = 'users';
+      $handler->display->display_options['arguments']['uid']['field'] = 'uid';
+      $view->set_arguments(array($this->user1->uid));
+      $view->execute();
+
+      switch ($r_index) {
+        case -1:
+          // Directional, both ways.
+          $this->assertEqual(count($view->result), 2);
+          $matches = array($this->node3->nid => TRUE, $this->node4->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->node_users_nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+        case 0:
+          // Source. This finds the u1->p3 and u1->p4 relation.
+          $this->assertEqual(count($view->result), 2);
+          $matches = array($this->node3->nid => TRUE, $this->node4->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->node_users_nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+        case 1:
+          // Target. This finds no relations.
+          $this->assertEqual(count($view->result), 0);
+          $matches = array();
+          foreach ($view->result as $result) {
+            unset($matches[$result->node_users_nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+      }
+    }
+
+    // Reverse directional to source, to target and to both with different entities types.
+    for ($r_index = -1; $r_index < 2; $r_index++) {
+      $view = new view;
+      $view->base_table = 'node';
+      $handler = $view->new_display('default');
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_user']['id'] = 'relation_directional_entitydifferent_user';
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_user']['table'] = 'node';
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_user']['field'] = 'relation_directional_entitydifferent_user';
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_user']['required'] = 1;
+      $handler->display->display_options['relationships']['relation_directional_entitydifferent_user']['r_index'] = $r_index;
+      $handler->display->display_options['fields']['nid']['id'] = 'nid';
+      $handler->display->display_options['fields']['nid']['table'] = 'node';
+      $handler->display->display_options['fields']['nid']['field'] = 'nid';
+      $handler->display->display_options['arguments']['uid']['id'] = 'uid';
+      $handler->display->display_options['arguments']['uid']['table'] = 'users';
+      $handler->display->display_options['arguments']['uid']['field'] = 'uid';
+      $handler->display->display_options['arguments']['uid']['relationship'] = 'relation_directional_entitydifferent_user';
+      $view->set_arguments(array($this->user1->uid));
+      $view->execute();
+
+      switch ($r_index) {
+        case -1:
+          // Directional, both ways.
+          $this->assertEqual(count($view->result), 2);
+          $matches = array($this->node3->nid => TRUE, $this->node4->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+        case 0:
+          // Source. This finds no relations.
+          $this->assertEqual(count($view->result), 0);
+          $matches = array();
+          foreach ($view->result as $result) {
+            unset($matches[$result->nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+        case 1:
+          // Target. This finds the u1->p3 and u1->p4 relation.
+          $this->assertEqual(count($view->result), 2);
+          $matches = array($this->node3->nid => TRUE, $this->node4->nid => TRUE);
+          foreach ($view->result as $result) {
+            unset($matches[$result->nid]);
+          }
+          $this->assertFalse($matches);
+          break;
+      }
+    }
   }
 }
diff --git a/views/relation.views.inc b/views/relation.views.inc
index 2e79632..d4ee53c 100644
--- a/views/relation.views.inc
+++ b/views/relation.views.inc
@@ -211,6 +211,7 @@ function relation_views_data_alter(&$data) {
         $entity_type_right = $target_bundle[0];
         $base_table_right = $entity_tables[$entity_type_right];
         $t_arguments['@right'] = $entity_type_right;
+        // Provide forward relationships
         $data[$base_table_left]['relation_' . $type . '_' . $entity_type_right] = array(
           'title' => t('Relation: @relation_type_label (@left <-> @right)', $t_arguments),
           'help' => t('Provides a relationship from @left to @right via the relation @relation_type_label', $t_arguments),
@@ -242,6 +243,25 @@ function relation_views_data_alter(&$data) {
             'directional' => $relation_type->directional,
           ),
         );
+        // Provide reverse relationships
+        if ($entity_type_right != $entity_type_left) {
+          $data[$base_table_right]['relation_' . $type . '_' . $entity_type_left] = array(
+            'title' => t('Relation: @relation_type_label (@right <-> @left)', $t_arguments),
+            'help' => t('Provides a reverse relationship from @right to @left via the relation @relation_type_label', $t_arguments),
+            'relationship' => array(
+              // relation_handler_relationship::options_form() relies on this check_plain().
+              'label' => check_plain($relation_type->reverse_label),
+              'base' => $base_table_left,
+              'base field' => $relationship_field,
+              'relationship field' => $entity_infos[$entity_type_right]['entity keys']['id'],
+              'handler' => 'relation_handler_relationship',
+              'relation_type' => $type,
+              'entity_type_left' => $entity_type_right,
+              'entity_type_right' => $entity_type_left,
+              'directional' => $relation_type->directional,
+            ),
+          );
+        }
       }
     }
   }
