RelationshipVortex - Add to list of example fields in MergerTest::testGetCidRefs
authorTim Otten <totten@civicrm.org>
Tue, 7 Jul 2020 09:18:45 +0000 (02:18 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 16 Jul 2020 22:21:09 +0000 (15:21 -0700)
tests/phpunit/CRM/Dedupe/MergerTest.php

index aa8135844d199e8c43e78dbb4176edc4f1cf7b28..eba607a8019c2c0eb83704d0adfe209170ea98ff 100644 (file)
@@ -284,11 +284,25 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
    * The goal of this function is to test that all required tables are returned.
    */
   public function testGetCidRefs() {
+    $sortRefs = function($a) {
+      ksort($a);
+      foreach ($a as &$fields) {
+        sort($fields);
+      }
+      return $a;
+    };
+
     $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, 'Contacts');
+
     // These are deliberately unset.
     $unsetRefs = array_fill_keys(['civicrm_group_contact_cache', 'civicrm_acl_cache', 'civicrm_acl_contact_cache'], 1);
-    $this->assertEquals(array_diff_key($this->getStaticCIDRefs(), $unsetRefs), CRM_Dedupe_Merger::cidRefs());
-    $this->assertEquals(array_diff_key($this->getCalculatedCIDRefs(), $unsetRefs), CRM_Dedupe_Merger::cidRefs());
+    $this->assertEquals($sortRefs(array_diff_key($this->getStaticCIDRefs(), $unsetRefs)), $sortRefs(CRM_Dedupe_Merger::cidRefs()));
+    $this->assertEquals($sortRefs(array_diff_key($this->getCalculatedCIDRefs(), $unsetRefs)), $sortRefs(CRM_Dedupe_Merger::cidRefs()));
+
+    // These are deliberately unset.
+    // $unsetRefs = array_fill_keys(['civicrm_group_contact_cache', 'civicrm_acl_cache', 'civicrm_acl_contact_cache', 'civicrm_relationship_vtx'], 1);
+    // $this->assertEquals(array_diff_key($this->getStaticCIDRefs(), $unsetRefs), CRM_Dedupe_Merger::cidRefs());
+    // $this->assertEquals(array_diff_key($this->getCalculatedCIDRefs(), $unsetRefs), CRM_Dedupe_Merger::cidRefs());
   }
 
   /**
@@ -1329,6 +1343,10 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
         0 => 'contact_id_a',
         1 => 'contact_id_b',
       ],
+      'civicrm_relationship_vtx' => [
+        0 => 'near_contact_id',
+        1 => 'far_contact_id',
+      ],
       'civicrm_report_instance' => [
         0 => 'created_id',
         1 => 'owner_id',