Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
monishdeb committed Dec 31, 2019
1 parent 7b744de commit 1c412b4
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions tests/phpunit/CRM/Export/BAO/ExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,34 +421,23 @@ public function testMergeSameAddressOnExport() {
]);
$contactIDs = array_merge($this->contactIDs, [$householdID]);
$params = ['contact_id' => $contactIDs];
list($tableName, $sqlColumns) = CRM_Export_BAO_Export::exportComponents(
FALSE,
$contactIDs,
CRM_Contact_BAO_Query::convertFormValues($params),
NULL,
NULL,
NULL,
CRM_Export_Form_Select::CONTACT_EXPORT,
NULL,
NULL,
TRUE,
FALSE,
array(
'suppress_csv_for_testing' => TRUE,
)
);
$exportedRows = CRM_Utils_SQL_Select::from($tableName)->execute()->fetchAll();
$this->assertEquals(1, count($exportedRows));

$this->doExportTest([
'selectAll' => FALSE,
'ids' => $contactIDs,
'mergeSameAddress' => TRUE,
]);
$this->assertEquals(1, $this->csv->count());

$exportedRows = $this->csv->fetchOne();

$expectedValues = [
'civicrm_primary_id' => $householdID,
'contact_type' => 'Household',
'Contact ID' => $householdID,
'Contact Type' => 'Household',
];
foreach ($expectedValues as $columnName => $expectedValue) {
$this->assertEquals($expectedValue, $exportedRows[0][$columnName]);
$this->assertEquals($expectedValue, $exportedRows[$columnName]);
}
// delete the export temp table and component table
$sql = "DROP TABLE IF EXISTS {$tableName}";
CRM_Core_DAO::executeQuery($sql);
}

/**
Expand Down

0 comments on commit 1c412b4

Please sign in to comment.