From 601200b4c126e5bb390bbd02f9569efa22437579 Mon Sep 17 00:00:00 2001
From: Jesse Hofmann-Smith <jesse@opensourcery.com>
Date: Tue, 19 Nov 2013 15:47:02 -0800
Subject: [PATCH] Inline code comments for testSaveIdMapping() PHPUnit test

---
 tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php b/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php
index fe03840..1567e9f 100644
--- a/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php
+++ b/tests/Drupal/migrate/Tests/MigrateSqlIdMapTest.php
@@ -68,7 +68,7 @@ class MigrateSqlIdMapTest extends MigrateTestCase {
    * - saving new to nonempty tables work.
    * - updating work.
    */
-  public function testSsaveIdMapping() {
+  public function testSaveIdMapping() {
     $source = array(
       'source_id_property' => 'source_value',
     );
@@ -80,22 +80,29 @@ class MigrateSqlIdMapTest extends MigrateTestCase {
       'rollback_action' => 0,
       'hash' => '',
     );
-    $expected_result = array(array(
+    // Expected_result is an array of arrays, each one representing a database row.
+    $expected_result = array();
+    $expected_result[] = array(
       'sourceid1' => 'source_value',
       'destid1' => 2,
-    ) + $expected_defaults);
+    ) + $expected_defaults;
+    // Check to see the migrate_map_sql_idmap_test table contains the expected row.
     $this->queryResultTest($this->database->databaseContents['migrate_map_sql_idmap_test'], $expected_result);
     $source = array(
       'source_id_property' => 'source_value_1',
     );
     $row = new Row($source, array('source_id_property' => array()));
     $id_map->saveIdMapping($row, array('destination_id_property' => 3));
+    // Expected_result should now have 2 rows.
     $expected_result[] = array(
       'sourceid1' => 'source_value_1',
       'destid1' => 3,
     ) + $expected_defaults;
+    // Check to see the migrate_map_sql_idmap_test table contains the expected 2 rows.
     $this->queryResultTest($this->database->databaseContents['migrate_map_sql_idmap_test'], $expected_result);
+    // This time saveIdMapping is called with the same $row object (hence same source_id property).
     $id_map->saveIdMapping($row, array('destination_id_property' => 4));
+    // The destid1 value for the second row (source_value_1) is now 4.
     $expected_result[1]['destid1'] = 4;
     $this->queryResultTest($this->database->databaseContents['migrate_map_sql_idmap_test'], $expected_result);
   }
-- 
1.8.3.4 (Apple Git-47)

