From 61ca7d1f456391ee0de2ab24eb650812f3fe57fd Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 20 Aug 2016 07:08:10 +1000 Subject: [PATCH] Add in test from previous PR --- CRM/Utils/Address.php | 1 + tests/phpunit/CRM/Utils/AddressTest.php | 36 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/phpunit/CRM/Utils/AddressTest.php 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')); + } + +} -- 2.25.1