$query = array_shift($tableQueries);
if ($searchWithinDupes) {
+ // drop dedupe_copy table just in case if its already there.
+ $dedupeCopyTemporaryTableObject->drop();
// get prepared to search within already found dupes if $searchWithinDupes flag is set
$dedupeCopyTemporaryTableObject->createWithQuery("SELECT * FROM {$this->temporaryTables['dedupe']} WHERE weight >= {$weightSum}");
}
+ /**
+ * Test rule from Richard
+ */
+ public function testRuleThreeContactFieldsEqualWeightWIthThresholdtheTotalSumOfAllWeight() {
+ $this->setupForGroupDedupe();
+
+ $ruleGroup = $this->callAPISuccess('RuleGroup', 'create', [
+ 'contact_type' => 'Individual',
+ 'threshold' => 30,
+ 'used' => 'General',
+ 'name' => 'TestRule',
+ 'title' => 'TestRule',
+ 'is_reserved' => 0,
+ ]);
+
+ foreach (['first_name', 'last_name', 'birth_date'] as $field) {
+ $rules[$field] = $this->callAPISuccess('Rule', 'create', [
+ 'dedupe_rule_group_id' => $ruleGroup['id'],
+ 'rule_table' => 'civicrm_contact',
+ 'rule_weight' => 10,
+ 'rule_field' => $field,
+ ]);
+ }
+ $foundDupes = CRM_Dedupe_Finder::dupesInGroup($ruleGroup['id'], $this->groupID);
+ $this->assertEquals(1, count($foundDupes));
+ }
+
/**
* Test a custom rule with a non-default field.
*/