+ /**
+ * Test that non-contact entity tags are untouched in merge.
+ *
+ * @throws \CRM_Core_Exception
+ */
+ public function testContributionEntityTag() {
+ $this->callAPISuccess('OptionValue', 'create', ['option_group_id' => 'tag_used_for', 'value' => 'civicrm_contribution', 'label' => 'Contribution']);
+ $tagID = $this->tagCreate(['name' => 'Big', 'used_for' => 'civicrm_contribution'])['id'];
+ $contact1 = (int) $this->individualCreate();
+ $contact2 = (int) $this->individualCreate();
+ $contributionID = NULL;
+ while ($contributionID !== $contact2) {
+ $contributionID = (int) $this->callAPISuccess('Contribution', 'create', ['contact_id' => $contact1, 'total_amount' => 5, 'financial_type_id' => 'Donation'])['id'];
+ }
+ $entityTagParams = ['entity_id' => $contributionID, 'entity_table' => 'civicrm_contribution', 'tag_id' => $tagID];
+ $this->callAPISuccess('EntityTag', 'create', $entityTagParams);
+ $this->callAPISuccessGetSingle('EntityTag', $entityTagParams);
+ $this->callAPISuccess('Job', 'process_batch_merge', ['mode' => 'safe']);
+ $this->callAPISuccessGetSingle('EntityTag', $entityTagParams);
+ }
+