[NFC] stop passing around variables that are cached anyway.
authoreileen <emcnaughton@wikimedia.org>
Tue, 22 May 2018 11:11:02 +0000 (23:11 +1200)
committereileen <emcnaughton@wikimedia.org>
Tue, 22 May 2018 11:11:02 +0000 (23:11 +1200)
CRM/Export/BAO/Export.php
tests/phpunit/CRM/Export/BAO/ExportTest.php

index a7e32923802efe3a118f38f9a5e0a3d29a5279aa..31c4218426e1a7cf75fe2734d43cd482a445e651 100644 (file)
@@ -766,7 +766,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
     // for CRM-3157 purposes
     $i18n = CRM_Core_I18n::singleton();
 
-    list($outputColumns, $headerRows, $sqlColumns, $metadata) = self::getExportStructureArrays($returnProperties, $query, $phoneTypes, $imProviders, $contactRelationshipTypes, $relationQuery, $selectedPaymentFields);
+    list($outputColumns, $headerRows, $sqlColumns, $metadata) = self::getExportStructureArrays($returnProperties, $query, $contactRelationshipTypes, $relationQuery, $selectedPaymentFields);
 
     $limitReached = FALSE;
     while (!$limitReached) {
@@ -1993,8 +1993,6 @@ WHERE  {$whereClause}";
    *
    * @param array $returnProperties
    * @param CRM_Contact_BAO_Contact $query
-   * @param array $phoneTypes
-   * @param array $imProviders
    * @param array $contactRelationshipTypes
    * @param string $relationQuery
    * @param array $selectedPaymentFields
@@ -2014,8 +2012,10 @@ WHERE  {$whereClause}";
    *    - b) this code is old & outdated. Submit your answers to circular bin or better
    *       yet find a way to comment them for posterity.
    */
-  public static function getExportStructureArrays($returnProperties, $query, $phoneTypes, $imProviders, $contactRelationshipTypes, $relationQuery, $selectedPaymentFields) {
+  public static function getExportStructureArrays($returnProperties, $query, $contactRelationshipTypes, $relationQuery, $selectedPaymentFields) {
     $metadata = $headerRows = $outputColumns = $sqlColumns = array();
+    $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
+    $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
 
     foreach ($returnProperties as $key => $value) {
       if ($key != 'location' || !is_array($value)) {
index bca2f636756e4ab6366c0a87af17a01add00773c..ccaba5a0755e69b15d2336681096207a0c60b10f 100644 (file)
@@ -172,8 +172,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
       'trxn_id' => 1,
       'contribution_id' => 1,
     );
-    $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
-    $imProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
+
     $contactRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(
       NULL,
       NULL,
@@ -194,7 +193,7 @@ class CRM_Export_BAO_ExportTest extends CiviUnitTestCase {
     $queryFieldAliases = array();
     preg_match_all($pattern, $select, $queryFieldAliases, PREG_PATTERN_ORDER);
 
-    list($outputFields) = CRM_Export_BAO_Export::getExportStructureArrays($returnProperties, $query, $phoneTypes, $imProviders, $contactRelationshipTypes, '', array());
+    list($outputFields) = CRM_Export_BAO_Export::getExportStructureArrays($returnProperties, $query, $contactRelationshipTypes, '', array());
     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');