Skip to content

Commit

Permalink
Add in unit test to lock in the fix for dev_core_2272
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Dec 23, 2020
1 parent 38c3ddc commit 5c55a5e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/phpunit/CRM/Export/BAO/ExportTest.php
Expand Up @@ -664,6 +664,40 @@ public function testExportRelationshipsMergeToHousehold($includeHouseHold) {
$this->assertEquals('household sauce', $row['Contact Source']);
}

/**
* Test exporting contacts merged into households
*
* This is to ensure that CRM-13995 remains fixed.
*
* @dataProvider getBooleanDataProvider
*
* @param bool $includeHouseHold
*
* @throws CRM_Core_Exception
* @throws \League\Csv\Exception
*/
public function testExportMergeToHousehold($includeHouseHold) {
list($householdID, $houseHoldTypeID) = $this->setUpHousehold();

if ($includeHouseHold) {
$this->contactIDs[] = $householdID;
}
$selectedFields = [
['contact_type' => 'Individual', 'name' => 'contact_source', 'location_type_id' => ''],
];
$this->doExportTest([
'ids' => $this->contactIDs,
'fields' => $selectedFields,
'mergeSameHousehold' => TRUE,
'componentTable' => 'civicrm_contact',
'componentClause' => 'contact_a.id IN (' . implode(',', $this->contactIDs) . ')',
]);
$row = $this->csv->fetchOne();
$this->assertCount(1, $this->csv);
$this->assertEquals($householdID, $row['Household ID']);

}

/**
* Test exporting relationships.
*
Expand Down

0 comments on commit 5c55a5e

Please sign in to comment.