*
* @throws \Exception
*/
- public function tearDown() {
+ public function tearDown(): void {
$this->quickCleanUpFinancialEntities();
$this->quickCleanup([
'civicrm_contact',
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportComponentsNull() {
+ public function testExportComponentsNull(): void {
$this->doExportTest([]);
}
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportComponentsContribution() {
+ public function testExportComponentsContribution(): void {
$this->setUpContributionExportData();
$selectedFields = [
['contact_type' => 'Individual', 'name' => 'first_name'],
'componentClause' => 'civicrm_contribution.id IN ( ' . implode(',', $this->contributionIDs) . ')',
]);
$this->assertContains('display', array_values($this->csv->getHeader()));
- $row = $this->csv->fetchOne(0);
+ $row = $this->csv->fetchOne();
$this->assertEquals('This is a test', $row['display']);
}
/**
* Implements hook_civicrm_export().
- *
*/
- public function confirmHookWasCalled(&$exportTempTable, &$headerRows, &$sqlColumns, $exportMode, $componentTable, $ids) {
+ public function confirmHookWasCalled($exportTempTable, &$headerRows, &$sqlColumns, $exportMode, $componentTable, $ids): void {
$sqlColumns['display'] = 'display varchar(255)';
$headerRows[] = 'display';
CRM_Core_DAO::executeQuery("ALTER TABLE $exportTempTable ADD COLUMN display varchar(255)");
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportComponentsContributionSoftCredits() {
+ public function testExportComponentsContributionSoftCredits(): void {
$this->setUpContributionExportData();
$this->callAPISuccess('ContributionSoft', 'create', ['contact_id' => $this->contactIDs[1], 'contribution_id' => $this->contributionIDs[0], 'amount' => 5]);
$params = [
$this->assertEquals(array_merge($this->getBasicHeaderDefinition(FALSE), $this->getContributeHeaderDefinition()), $this->csv->getHeader());
$this->assertCount(3, $this->csv);
- $row = $this->csv->fetchOne(0);
+ $row = $this->csv->fetchOne();
$this->assertEquals(95, $row['Net Amount']);
$this->assertEquals('', $row['Soft Credit Amount']);
$row = $this->csv->fetchOne(1);
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportComponentsMembership() {
+ public function testExportComponentsMembership(): void {
$this->setUpMembershipExportData();
$this->doExportTest([
'selectAll' => TRUE,
* Basic test to ensure the exportComponents function can export selected fields for activity
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testExportComponentsActivity() {
+ public function testExportComponentsActivity(): void {
$this->setUpActivityExportData();
$selectedFields = [
['contact_type' => 'Individual', 'name' => 'display_name'],
* repeated 100,000 times and in general we should simply be able to match the query fields to
* our expected rows & do a little pseudoconstant mapping.
*/
- public function testGetExportStructureArrays() {
+ public function testGetExportStructureArrays(): void {
// This is how return properties are formatted internally within the function for passing to the BAO query.
$returnProperties = [
'first_name' => 1,
FALSE, TRUE, TRUE, NULL, 'AND'
);
- list($select) = $query->query();
+ [$select] = $query->query();
$pattern = '/as `?([^`,]*)/';
$queryFieldAliases = [];
- preg_match_all($pattern, $select, $queryFieldAliases, PREG_PATTERN_ORDER);
+ preg_match_all($pattern, $select, $queryFieldAliases);
$processor = new CRM_Export_BAO_ExportProcessor(CRM_Contact_BAO_Query::MODE_CONTRIBUTE, NULL, 'AND');
$processor->setQueryFields($query->_fields);
$processor->setReturnProperties($returnProperties);
- list($outputFields) = $processor->getExportStructureArrays();
+ [$outputFields] = $processor->getExportStructureArrays();
foreach (array_keys($outputFields) as $fieldAlias) {
if ($fieldAlias === 'Home-country') {
- $this->assertTrue(in_array($fieldAlias . '_id', $queryFieldAliases[1]), 'Country is subject to some funky translate so we make sure country id is present');
+ $this->assertContains($fieldAlias . '_id', $queryFieldAliases[1], 'Country is subject to some funky translate so we make sure country id is present');
}
else {
- $this->assertTrue(in_array($fieldAlias, $queryFieldAliases[1]), 'looking for field ' . $fieldAlias . ' in generaly the alias fields need to match the outputfields');
+ $this->assertContains($fieldAlias, $queryFieldAliases[1], 'looking for field ' . $fieldAlias . ' in generaly the alias fields need to match the outputfields');
}
}
* Set up some data for us to do testing on.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function setUpContributionExportData() {
+ public function setUpContributionExportData(): void {
$this->setUpContactExportData();
$this->contributionIDs[] = $this->contributionCreate(['contact_id' => $this->contactIDs[0], 'trxn_id' => 'null', 'invoice_id' => 'null', 'receive_date' => '2019-07-25 07:34:23']);
$this->contributionIDs[] = $this->contributionCreate(['contact_id' => $this->contactIDs[1], 'trxn_id' => 'null', 'invoice_id' => 'null', 'receive_date' => '2018-12-01 00:00:00']);
* Set up some data for us to do testing on.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function setUpMembershipExportData() {
+ public function setUpMembershipExportData(): void {
$this->setUpContactExportData();
// Create an extra so we don't get false passes due to 1
$this->contactMembershipCreate(['contact_id' => $this->contactIDs[0]]);
* Set up data to test case export.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function setupCaseExportData() {
+ public function setupCaseExportData(): void {
$contactID1 = $this->individualCreate();
$contactID2 = $this->individualCreate([], 1);
* Set up some data for us to do testing on.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function setUpActivityExportData() {
+ public function setUpActivityExportData(): void {
$this->setUpContactExportData();
$this->activityIDs[] = $this->activityCreate(['contact_id' => $this->contactIDs[0]])['id'];
}
* Set up some data for us to do testing on.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function setUpContactExportData() {
+ public function setUpContactExportData(): void {
$this->contactIDs[] = $contactA = $this->individualCreate(['gender_id' => 'Female']);
// Create address for contact A.
$params = [
*
* @param int $isPrimaryOnly
*
- * @dataProvider getBooleanDataProvider
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
+ * @dataProvider getBooleanDataProvider
*/
- public function testExportPrimaryAddress($isPrimaryOnly) {
- \Civi::settings()->set('searchPrimaryDetailsOnly', $isPrimaryOnly);
+ public function testExportPrimaryAddress($isPrimaryOnly): void {
+ Civi::settings()->set('searchPrimaryDetailsOnly', $isPrimaryOnly);
$this->setUpContactExportData();
$selectedFields = [
'Home-Email' => 'home@example.com',
'Work-Email' => 'work@example.com',
], $row);
- $this->assertEquals(2, count($this->csv));
- \Civi::settings()->set('searchPrimaryDetailsOnly', FALSE);
+ $this->assertCount(2, $this->csv);
+ Civi::settings()->set('searchPrimaryDetailsOnly', FALSE);
}
/**
* does NOT retain the gender of the former.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testExportPseudoField() {
+ public function testExportPseudoField(): void {
$this->setUpContactExportData();
$this->callAPISuccess('OptionValue', 'create', ['option_group_id' => 'gender', 'name' => 'Really long string', 'value' => 678, 'label' => 'Really long string']);
$selectedFields = [['contact_type' => 'Individual', 'name' => 'gender_id']];
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportPseudoFieldCampaign() {
+ public function testExportPseudoFieldCampaign(): void {
$this->setUpContributionExportData();
$campaign = $this->callAPISuccess('Campaign', 'create', ['title' => 'Big campaign and kinda long too']);
$this->callAPISuccess('Contribution', 'create', ['campaign_id' => $campaign['id'], 'id' => $this->contributionIDs[0]]);
* Test exporting relationships.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testExportRelationships() {
+ public function testExportRelationships(): void {
$organization1 = $this->organizationCreate(['organization_name' => 'Org 1', 'legal_name' => 'pretty legal', 'contact_source' => 'friend who took a law paper once']);
$organization2 = $this->organizationCreate(['organization_name' => 'Org 2', 'legal_name' => 'well dodgey']);
$contact1 = $this->individualCreate(['employer_id' => $organization1, 'first_name' => 'one']);
* @throws CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportRelationshipsMergeToHousehold($includeHouseHold) {
- list($householdID, $houseHoldTypeID) = $this->setUpHousehold();
+ public function testExportRelationshipsMergeToHousehold($includeHouseHold): void {
+ [$householdID, $houseHoldTypeID] = $this->setUpHousehold();
if ($includeHouseHold) {
$this->contactIDs[] = $householdID;
* @throws CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportMergeToHousehold($includeHouseHold) {
- list($householdID, $houseHoldTypeID) = $this->setUpHousehold();
+ public function testExportMergeToHousehold($includeHouseHold): void {
+ [$householdID, $houseHoldTypeID] = $this->setUpHousehold();
if ($includeHouseHold) {
$this->contactIDs[] = $householdID;
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportRelationshipsMergeToHouseholdAllFields() {
- list($householdID) = $this->setUpHousehold();
+ public function testExportRelationshipsMergeToHouseholdAllFields(): void {
+ [$householdID] = $this->setUpHousehold();
$this->doExportTest(['ids' => $this->contactIDs, 'mergeSameHousehold' => TRUE]);
$row = $this->csv->fetchOne();
$this->assertCount(1, $this->csv);
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \Civi\API\Exception\UnauthorizedException
* @throws \League\Csv\Exception
*/
- public function testExportCustomData() {
+ public function testExportCustomData(): void {
$this->setUpContactExportData();
$this->entity = 'Contact';
$this->createCustomGroupWithFieldsOfAllTypes();
* Attempt to do a fairly full export of location data.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testExportIMData() {
+ public function testExportIMData(): void {
// Use default providers.
- $providers = ['Aim', 'Gtalk', 'Jabber', 'Msn', 'Skype', 'Yahoo'];
+ $providers = ['AIM' => 'Aim', 'GTalk' => 'Gtalk', 'Jabber' => 'Jabber', 'MSN' => 'Msn', 'Skype' => 'Skype', 'Yahoo' => 'Yahoo'];
// Main sure labels are not all anglo chars.
$this->diversifyLocationTypes();
foreach ($this->csv->getRecords() as $row) {
$id = $row['Contact ID'];
- $this->assertEquals('AIM', $row['Billing-IM Provider']);
- $this->assertEquals('AIM', $row['Whare Kai-IM Provider']);
+ // The provider could be any of them as we created multiple ims for each location
+ // type. In earlier mysql versions it gets a somewhat consistent result but there
+ // is no 'right' provider so we just check it is a resolved pseudoconstant.
+ $this->assertContains($row['Billing-IM Provider'], array_keys($providers));
+ $this->assertContains($row['Whare Kai-IM Provider'], array_keys($providers));
$this->assertEquals('BillingJabber' . $id, $row['Billing-IM Screen Name-Jabber']);
$this->assertEquals('Whare KaiJabber' . $id, $row['Whare Kai-IM Screen Name-Jabber']);
$this->assertEquals('BillingSkype' . $id, $row['Billing-IM Screen Name-Skype']);
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \Civi\API\Exception\UnauthorizedException
* @throws \League\Csv\Exception
*/
- public function testExportPhoneData() {
+ public function testExportPhoneData(): void {
$this->contactIDs[] = $this->individualCreate();
$this->contactIDs[] = $this->individualCreate();
* Export City against multiple location types.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testExportAddressData() {
+ public function testExportAddressData(): void {
$this->diversifyLocationTypes();
$locationTypes = ['Billing' => 'Billing', 'Home' => 'Home', 'Main' => 'Méin', 'Other' => 'Other', 'Whare Kai' => 'Whare Kai'];
* Test master_address_id field when no merge is in play.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testExportMasterAddress() {
+ public function testExportMasterAddress(): void {
$this->setUpContactExportData();
//export the master address for contact B
* Test merging same address when specifying fields.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testMergeSameAddressSpecifyFields() {
+ public function testMergeSameAddressSpecifyFields(): void {
$this->setUpContactSameAddressExportData();
$this->doExportTest(['mergeSameAddress' => TRUE, 'fields' => [['contact_type' => 'Individual', 'name' => 'master_id', 'location_type_id' => 1]]]);
}
* Test the merge same address option.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testMergeSameAddress() {
+ public function testMergeSameAddress(): void {
$this->setUpContactSameAddressExportData();
$this->doExportTest(['mergeSameAddress' => TRUE]);
// ie 2 merged, one extra.
* Tests the options for greeting templates when choosing to merge same address.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testMergeSameAddressGreetingOptions() {
+ public function testMergeSameAddressGreetingOptions(): void {
$this->setUpContactSameAddressExportData();
$this->callAPISuccess('OptionValue', 'create', [
'option_group_id' => 'postal_greeting',
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportNoRows() {
+ public function testExportNoRows(): void {
$contactA = $this->callAPISuccess('contact', 'create', [
'first_name' => 'John',
'last_name' => 'Doe',
* So C take preference over A and thus C is exported as result.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testMergeSameAddressOnExport() {
+ public function testMergeSameAddressOnExport(): void {
$this->individualCreate();
$householdID = $this->setUpHousehold()[0];
$contactIDs = array_merge($this->contactIDs, [$householdID]);
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportDeceasedDoNotMail($reason, $addressReason) {
+ public function testExportDeceasedDoNotMail($reason, $addressReason): void {
$contactA = $this->callAPISuccess('contact', 'create', [
'first_name' => 'John',
'last_name' => 'Doe',
'mergeSameAddress' => TRUE,
],
]);
- $row = $this->csv->fetchOne(0);
+ $row = $this->csv->fetchOne();
- $this->assertTrue(!in_array('Stage', $this->processor->getHeaderRows()));
+ $this->assertNotTrue(in_array('Stage', $this->processor->getHeaderRows()));
$this->assertEquals('Dear John', $row['Email Greeting']);
$this->assertCount(1, $this->csv);
}
*
* @return array
*/
- public function getReasonsNotToMail() {
+ public function getReasonsNotToMail(): array {
return [
[['is_deceased' => 1], []],
[['do_not_mail' => 1], []],
*
* @return array
*
- * @throws CRM_Core_Exception
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- protected function setUpHousehold() {
+ protected function setUpHousehold(): array {
$this->setUpContactExportData();
$householdID = $this->householdCreate([
'source' => 'household sauce',
*
* @param int $exportMode
*/
- public function ensureComponentIsEnabled($exportMode) {
+ public function ensureComponentIsEnabled($exportMode): void {
if ($exportMode === CRM_Export_Form_Select::CASE_EXPORT) {
CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
}
* @param int $exportMode
* @param $expected
*/
- public function testAdditionalReturnProperties($exportMode, $expected) {
+ public function testAdditionalReturnProperties($exportMode, $expected): void {
$this->ensureComponentIsEnabled($exportMode);
$processor = new CRM_Export_BAO_ExportProcessor($exportMode, NULL, 'AND');
$metadata = $processor->getAdditionalReturnProperties();
* @param int $exportMode
* @param $expected
*/
- public function testDefaultReturnProperties($exportMode, $expected) {
+ public function testDefaultReturnProperties($exportMode, $expected): void {
$this->ensureComponentIsEnabled($exportMode);
$processor = new CRM_Export_BAO_ExportProcessor($exportMode, NULL, 'AND');
$metadata = $processor->getDefaultReturnProperties();
*
* @return array
*/
- public function additionalFieldsDataProvider() {
+ public function additionalFieldsDataProvider(): array {
return [
[
'anything that will then be defaulting ton contact',
/**
* get data for testing field metadata by query mode.
*/
- public function allFieldsDataProvider() {
+ public function allFieldsDataProvider(): array {
return [
[
'anything that will then be defaulting ton contact',
/**
* Get return properties manually added in.
*/
- public function getExtraReturnProperties() {
+ public function getExtraReturnProperties(): array {
return [];
}
*
* @return array
*/
- protected function getBasicReturnProperties($isContactMode) {
+ protected function getBasicReturnProperties($isContactMode): array {
$returnProperties = [
'id' => 1,
'contact_type' => 1,
*
* @return array
*/
- public function getPledgeReturnProperties() {
+ public function getPledgeReturnProperties(): array {
return [
'contact_type' => 1,
'contact_sub_type' => 1,
*
* @return array
*/
- public function getMembershipReturnProperties() {
+ public function getMembershipReturnProperties(): array {
return [
'contact_type' => 1,
'contact_sub_type' => 1,
*
* @return array
*/
- public function getEventReturnProperties() {
+ public function getEventReturnProperties(): array {
return [
'contact_type' => 1,
'contact_sub_type' => 1,
*
* @return array
*/
- public function getActivityReturnProperties() {
+ public function getActivityReturnProperties(): array {
return [
'activity_id' => 1,
'contact_type' => 1,
*
* @return array
*/
- public function getCaseReturnProperties() {
+ public function getCaseReturnProperties(): array {
return [
'contact_type' => 1,
'contact_sub_type' => 1,
*
* @return array
*/
- public function getContributionReturnProperties() {
+ public function getContributionReturnProperties(): array {
return [
'contact_type' => 1,
'contact_sub_type' => 1,
*
* @dataProvider getSqlColumnsOutput
*/
- public function testGetSQLColumnsAndHeaders($exportMode, $expected, $expectedHeaders) {
+ public function testGetSQLColumnsAndHeaders($exportMode, $expected, $expectedHeaders): void {
$this->ensureComponentIsEnabled($exportMode);
// We need some data so that we can get to the end of the export
// function. Hopefully one day that won't be required to get metadata info out.
* https://lab.civicrm.org/dev/core/issues/819
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
* @throws \League\Csv\Exception
*/
- public function testExportIncompleteSubmission() {
+ public function testExportIncompleteSubmission(): void {
$this->setUpContactExportData();
$this->doExportTest(['fields' => [['contact_type' => 'Individual', 'name' => '']], 'ids' => [$this->contactIDs[1]]]);
}
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function testExportSpecifyFields($exportMode, $selectedFields, $expected) {
+ public function testExportSpecifyFields($exportMode, $selectedFields, $expected): void {
$this->ensureComponentIsEnabled($exportMode);
$this->setUpContributionExportData();
$this->doExportTest(['fields' => $selectedFields, 'ids' => [$this->contactIDs[1]], 'exportMode' => $exportMode]);
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- public function textExportParticipantSpecifyFieldsNoPayment() {
+ public function textExportParticipantSpecifyFieldsNoPayment(): void {
$selectedFields = $this->getAllSpecifiableParticipantReturnFields();
foreach ($selectedFields as $index => $field) {
if (substr($field[1], 0, 22) === 'componentPaymentField_') {
* @todo - still being built up.
*
*/
- public function getAllSpecifiableReturnFields() {
+ public function getAllSpecifiableReturnFields(): array {
return [
[
CRM_Export_Form_Select::EVENT_EXPORT,
*
* @return array
*/
- public function getAllSpecifiableParticipantReturnColumns() {
+ public function getAllSpecifiableParticipantReturnColumns(): array {
return [
'participant_campaign_id' => '`participant_campaign_id` varchar(16)',
'participant_contact_id' => '`participant_contact_id` varchar(16)',
/**
* @return array
*/
- public function getAllSpecifiableParticipantReturnFields() {
+ public function getAllSpecifiableParticipantReturnFields(): array {
return [
0 =>
[
/**
* @param string $exportMode
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function setupBaseExportData($exportMode) {
+ public function setupBaseExportData($exportMode): void {
$this->createLoggedInUser();
if ($exportMode === CRM_Export_Form_Select::CASE_EXPORT) {
$this->setupCaseExportData();
*
* @return array
*/
- public function getSqlColumnsOutput() {
+ public function getSqlColumnsOutput(): array {
return [
[
'anything that will then be defaulting ton contact',
*
* @return array
*/
- protected function getBasicHeaderDefinition($isContactExport) {
+ protected function getBasicHeaderDefinition($isContactExport): array {
$headers = [
0 => 'Contact ID',
1 => 'Contact Type',
*
* @return array
*/
- protected function getActivityHeaderDefinition() {
+ protected function getActivityHeaderDefinition(): array {
return [
82 => 'Activity ID',
83 => 'Activity Type',
*
* @return array
*/
- protected function getCaseHeaderDefinition() {
+ protected function getCaseHeaderDefinition(): array {
return [
82 => 'Contact ID',
83 => 'Case ID',
*
* @return array
*/
- protected function getContributeHeaderDefinition() {
+ protected function getContributeHeaderDefinition(): array {
return [
82 => 'Financial Type',
83 => 'Contribution Source',
*
* @return array
*/
- protected function getParticipantHeaderDefinition() {
+ protected function getParticipantHeaderDefinition(): array {
return [
82 => 'Event ID',
83 => 'Event Title',
*
* @return array
*/
- protected function getMemberHeaderDefinition() {
+ protected function getMemberHeaderDefinition(): array {
return [
82 => 'Membership Type',
83 => 'Test',
*
* @return array
*/
- protected function getPledgeHeaderDefinition() {
+ protected function getPledgeHeaderDefinition(): array {
return [
82 => 'Pledge ID',
83 => 'Total Pledged',
*
* @return array
*/
- protected function getBasicSqlColumnDefinition($isContactExport) {
+ protected function getBasicSqlColumnDefinition($isContactExport): array {
$columns = [
'civicrm_primary_id' => '`civicrm_primary_id` varchar(16)',
'contact_type' => '`contact_type` varchar(64)',
*
* @return array
*/
- protected function getCaseSqlColumns() {
+ protected function getCaseSqlColumns(): array {
return [
'case_start_date' => '`case_start_date` varchar(32)',
'case_end_date' => '`case_end_date` varchar(32)',
*
* @return array
*/
- protected function getActivitySqlColumns() {
+ protected function getActivitySqlColumns(): array {
return [
'activity_id' => '`activity_id` varchar(16)',
'activity_type' => '`activity_type` varchar(255)',
*
* @return array
*/
- protected function getParticipantSqlColumns() {
+ protected function getParticipantSqlColumns(): array {
return [
'event_id' => '`event_id` varchar(16)',
'event_title' => '`event_title` varchar(255)',
*
* @return array
*/
- public function getContributionSqlColumns() {
+ public function getContributionSqlColumns(): array {
return [
'civicrm_primary_id' => '`civicrm_primary_id` varchar(16)',
'contact_type' => '`contact_type` varchar(64)',
*
* @return array
*/
- public function getPledgeSqlColumns() {
+ public function getPledgeSqlColumns(): array {
return [
'pledge_id' => '`pledge_id` varchar(16)',
'pledge_amount' => '`pledge_amount` varchar(32)',
*
* @return array
*/
- public function getMembershipSqlColumns() {
+ public function getMembershipSqlColumns(): array {
return [
'membership_type' => '`membership_type` varchar(128)',
'member_is_test' => '`member_is_test` varchar(16)',
* - name differs from label
* - non-anglo char in the label (not valid in the name).
*/
- protected function diversifyLocationTypes() {
+ protected function diversifyLocationTypes(): void {
$this->locationTypes['Main'] = $this->callAPISuccess('Location_type', 'get', [
'name' => 'Main',
'return' => 'id',
* @throws \CRM_Core_Exception
* @throws \League\Csv\Exception
*/
- protected function doExportTest($params) {
+ protected function doExportTest($params): void {
$fields = $params['fields'] ?? [];
$fieldDefaults = ['contact_type' => 'Individual', 'phone_type_id' => NULL, 'location_type_id' => NULL];
foreach ($fields as $key => $field) {
* @param array $row
* @param array $alternatives
*/
- protected function assertExpectedOutput(array $expected, array $row, array $alternatives = []) {
+ protected function assertExpectedOutput(array $expected, array $row, array $alternatives = []): void {
$variableFields = ['Created Date', 'Modified Date', 'Contact Hash'];
foreach ($expected as $key => $value) {
if (in_array($key, $variableFields)) {
- $this->assertTrue(!empty($row[$key]));
+ $this->assertNotTrue(empty($row[$key]));
}
elseif (array_key_exists($key, $alternatives)) {
$this->assertContains($row[$key], $alternatives[$key]);
* Test get preview function on export processor.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function testExportGetPreview() {
+ public function testExportGetPreview(): void {
$this->setUpContactExportData();
$fields = [
['contact_type' => 'Individual', 'name' => 'first_name'],
* Set up contacts which will be merged with the same address option.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- protected function setUpContactSameAddressExportData() {
+ protected function setUpContactSameAddressExportData(): void {
$this->setUpContactExportData();
$this->contactIDs[] = $contact3 = $this->individualCreate(['first_name' => 'Sarah', 'last_name' => 'Smith', 'prefix_id' => 'Dr.']);
// Create address for contact A.
* Test for single select Autocomplete custom field.
*
*/
- public function testSingleAndMultiSelectAutoComplete() {
+ public function testSingleAndMultiSelectAutoComplete(): void {
$customGroupId = $this->customGroupCreate([
'extends' => 'Individual',
])['id'];