Remove test-only functionality
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 25 Oct 2022 21:43:39 +0000 (10:43 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 26 Oct 2022 19:54:01 +0000 (08:54 +1300)
CRM/Utils/Address.php
tests/phpunit/CRM/Utils/AddressTest.php

index 3518d13e11dc849923eab400c5ccb5ddab1144e2..f50ea79949e615d14ba83dab0f8df73315fa167f 100644 (file)
@@ -298,13 +298,7 @@ class CRM_Utils_Address {
   ) {
     static $config = NULL;
 
-    if (!$format) {
-      $format = Civi::settings()->get('address_format');
-    }
-
-    if ($mailing) {
-      $format = Civi::settings()->get('mailing_format');
-    }
+    $format = Civi::settings()->get('mailing_format');
 
     $formatted = $format;
 
@@ -328,7 +322,7 @@ class CRM_Utils_Address {
     }
 
     //CRM-16876 Display countries in all caps when in mailing mode.
-    if ($mailing && !empty($fields['country'])) {
+    if (!empty($fields['country'])) {
       if (Civi::settings()->get('hideCountryMailingLabels')) {
         $domain = CRM_Core_BAO_Domain::getDomain();
         $domainLocation = CRM_Core_BAO_Location::getValues(['contact_id' => $domain->contact_id]);
index 803e9387a476cf141f1e6846b8f15216b95aa3ef..ea2c660295a7939856bce5387ac6ff3314ad4af9 100644 (file)
@@ -25,7 +25,7 @@ class CRM_Utils_AddressTest extends CiviUnitTestCase {
     $addressDetails = $address['values'][$address['id']];
     $countries = CRM_Core_PseudoConstant::country();
     $addressDetails['country'] = $countries[$addressDetails['country_id']];
-    $formatted_address = CRM_Utils_Address::formatMailingLabel($addressDetails, 'mailing_format', FALSE, TRUE);
+    $formatted_address = CRM_Utils_Address::formatMailingLabel($addressDetails);
     $this->assertTrue((bool) strstr($formatted_address, 'UNITED STATES'));
   }