From: Seamus Lee Date: Fri, 19 Aug 2016 21:08:10 +0000 (+1000) Subject: Add in test from previous PR X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=61ca7d1f456391ee0de2ab24eb650812f3fe57fd;p=civicrm-core.git Add in test from previous PR --- diff --git a/CRM/Utils/Address.php b/CRM/Utils/Address.php index 878390fb09..01429fb4f3 100644 --- a/CRM/Utils/Address.php +++ b/CRM/Utils/Address.php @@ -94,6 +94,7 @@ class CRM_Utils_Address { } } + //CRM-16876 Display countries in all caps when in mailing mode. if ($mailing && !empty($fields['country'])) { if (Civi::settings()->get('hideCountryMailingLabels')) { $domain = CRM_Core_BAO_Domain::getDomain(); diff --git a/tests/phpunit/CRM/Utils/AddressTest.php b/tests/phpunit/CRM/Utils/AddressTest.php new file mode 100644 index 0000000000..df22b6d672 --- /dev/null +++ b/tests/phpunit/CRM/Utils/AddressTest.php @@ -0,0 +1,36 @@ +callAPISuccess('contact', 'create', array( + 'first_name' => 'Micky', + 'last_name' => 'mouse', + 'contact_type' => 'Individual', + )); + $address = $this->callAPISuccess('address', 'create', array( + 'street_address' => '1 Happy Place', + 'city' => 'Miami', + 'state_province' => 'Flordia', + 'country' => 'United States', + 'postal_code' => 33101, + 'contact_id' => $contact['id'], + 'location_type_id' => 5, + 'is_primary' => 1, + )); + $addressDetails = $address['values'][$address['id']]; + $countries = CRM_Core_PseudoConstant::country(); + $addressDetails['country'] = $countries[$addressDetails['country_id']]; + $formatted_address = CRM_Utils_Address::format($addressDetails, 'mailing_format', FALSE, TRUE); + $this->assertTrue((bool) strstr($formatted_address, 'UNITED STATES')); + } + +}