From: eileen Date: Tue, 12 Jul 2016 06:51:18 +0000 (+1200) Subject: CRM-19035 update tests to reflect consist use of entity1 for dstID X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=08cde01f497cf258d782f48c11469c6f532c128e;p=civicrm-core.git CRM-19035 update tests to reflect consist use of entity1 for dstID Since we should always see the lower id in dstID now and that should always map to entity1 the tests need updating --- diff --git a/CRM/Dedupe/BAO/RuleGroup.php b/CRM/Dedupe/BAO/RuleGroup.php index a6ea3542fc..1e156066ed 100644 --- a/CRM/Dedupe/BAO/RuleGroup.php +++ b/CRM/Dedupe/BAO/RuleGroup.php @@ -378,7 +378,8 @@ class CRM_Dedupe_BAO_RuleGroup extends CRM_Dedupe_DAO_RuleGroup { list($this->_aclFrom, $this->_aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause(array('c1', 'c2')); $this->_aclWhere = $this->_aclWhere ? "AND {$this->_aclWhere}" : ''; } - $query = "SELECT dedupe.id1, dedupe.id2, dedupe.weight + $query = "SELECT IF(dedupe.id1 < dedupe.id2, dedupe.id1, dedupe.id2) as id1, + IF(dedupe.id1 < dedupe.id2, dedupe.id2, dedupe.id1) as id2, dedupe.weight FROM dedupe JOIN civicrm_contact c1 ON dedupe.id1 = c1.id JOIN civicrm_contact c2 ON dedupe.id2 = c2.id {$this->_aclFrom} LEFT JOIN civicrm_dedupe_exception exc ON dedupe.id1 = exc.contact_id1 AND dedupe.id2 = exc.contact_id2 diff --git a/tests/phpunit/CRM/Core/BAO/PrevNextCacheTest.php b/tests/phpunit/CRM/Core/BAO/PrevNextCacheTest.php index 4883618798..4d177bf660 100644 --- a/tests/phpunit/CRM/Core/BAO/PrevNextCacheTest.php +++ b/tests/phpunit/CRM/Core/BAO/PrevNextCacheTest.php @@ -48,8 +48,8 @@ class CRM_Core_BAO_PrevNextCacheTest extends CiviUnitTestCase { $dao->id = 1; CRM_Core_BAO_PrevNextCache::flipPair(array(1), 0); $dao->find(TRUE); - $this->assertEquals(2, $dao->entity_id1); - $this->assertEquals(1, $dao->entity_id2); + $this->assertEquals(1, $dao->entity_id1); + $this->assertEquals(2, $dao->entity_id2); $this->assertEquals(serialize(array( 'srcName' => 'Mr. Maurice Mouse II', 'dstID' => 1, diff --git a/tests/phpunit/CRM/Dedupe/MergerTest.php b/tests/phpunit/CRM/Dedupe/MergerTest.php index 1faee3cb2f..c9cc7c67fc 100644 --- a/tests/phpunit/CRM/Dedupe/MergerTest.php +++ b/tests/phpunit/CRM/Dedupe/MergerTest.php @@ -284,17 +284,17 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase { $this->assertEquals(array( 0 => array( - 'srcID' => $this->contacts[0]['id'], + 'srcID' => $this->contacts[1]['id'], 'srcName' => 'Mr. Mickey Mouse II', - 'dstID' => $this->contacts[1]['id'], + 'dstID' => $this->contacts[0]['id'], 'dstName' => 'Mr. Mickey Mouse II', 'weight' => 20, 'canMerge' => TRUE, ), 1 => array( - 'srcID' => $this->contacts[2]['id'], + 'srcID' => $this->contacts[3]['id'], 'srcName' => 'Mr. Minnie Mouse II', - 'dstID' => $this->contacts[3]['id'], + 'dstID' => $this->contacts[2]['id'], 'dstName' => 'Mr. Minnie Mouse II', 'weight' => 20, 'canMerge' => TRUE,