From 7c01f2571eda9c71002efcea475347c71eb253f9 Mon Sep 17 00:00:00 2001
From: Jesse Hofmann-Smith <jesse@opensourcery.com>
Date: Sun, 1 Dec 2013 22:23:25 -0800
Subject: [PATCH] adding test for getRowByDestination function

---
 .../Drupal/migrate/Tests/MigrateSqlIdMapTest.php   | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php
index 466b814..e47974e 100644
--- a/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php
+++ b/core/modules/migrate/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php
@@ -297,6 +297,33 @@ protected function performLookupDestinationIDTest($num_source_fields, $num_desti
   }
 
   /**
+   * Test the getRowByDestination method.
+   */
+  public function testGetRowByDestination() {
+    $row = array(
+      'sourceid1' => 'source_id_value_1',
+      'sourceid2' => 'source_id_value_2',
+      'destid1' => 'destination_id_value_1',
+    ) + $this->idMapDefaults();
+    $database_contents['migrate_map_sql_idmap_test'][] = $row;
+    $row = array(
+      'sourceid1' => 'source_id_value_3',
+      'sourceid2' => 'source_id_value_4',
+      'destid1' => 'destination_id_value_2',
+    ) + $this->idMapDefaults();
+    $database_contents['migrate_map_sql_idmap_test'][] = $row;
+    $dest_id_values = array($row['destid1']);
+    $id_map = $this->getIdMap($database_contents);
+    $result_row = $id_map->getRowByDestination($dest_id_values);
+    $this->assertSame($row, $result_row);
+    // This value does not exist.
+    $dest_id_values = array('invalid_destination_id_property');
+    $id_map = $this->getIdMap($database_contents);
+    $result_row = $id_map->getRowByDestination($dest_id_values);
+    $this->assertSame(false, $result_row);
+  }
+
+  /**
    * Tests the source ID lookup method.
    *
    * Scenarios to test (for both hits and misses) are:
-- 
1.8.3.4 (Apple Git-47)

