From 780e3b449f4eb62e9f1d7f12dcba0a2e0f3e4ac8 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 12 Mar 2021 18:38:20 +1300 Subject: [PATCH] Add further test for token custom fields --- .../CRM/Core/BAO/MessageTemplateTest.php | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php b/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php index b81a0014b9..041a97dab9 100644 --- a/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php +++ b/tests/phpunit/CRM/Core/BAO/MessageTemplateTest.php @@ -50,7 +50,7 @@ class CRM_Core_BAO_MessageTemplateTest extends CiviUnitTestCase { 'idHash' => substr(sha1(CIVICRM_SITE_KEY . '1234'), 0, 7), ]; - [$sent, $subject, $message] = CRM_Core_BAO_MessageTemplate::sendTemplate( + [, $subject, $message] = CRM_Core_BAO_MessageTemplate::sendTemplate( [ 'valueName' => 'case_activity', 'contactId' => $contact_id, @@ -139,7 +139,7 @@ London, 90210 * @throws \CiviCRM_API3_Exception */ public function testContactTokens(): void { - $this->createCustomGroupWithFieldOfType([], 'contact_reference'); + $this->createCustomGroupWithFieldsOfAllTypes([]); $tokenData = $this->getAllContactTokens(); $this->callAPISuccess('Contact', 'create', $tokenData); $address = $this->callAPISuccess('Address', 'create', array_merge($tokenData, ['is_primary' => TRUE])); @@ -237,7 +237,18 @@ im:IM Screen Name openid:OpenID world_region:America South, Central, North and Caribbean url:http://civicrm.org -custom_1:Mr. Spider Man II +custom_1:Bobsled +custom_2:Red +custom_3:01/20/2021 12:00AM +custom_4:999 +custom_5:http://civicrm.org +custom_7:New Zealand +custom_8:France, Canada +custom_9:Mr. Spider Man II +custom_10:Queensland +custom_11:Victoria, New South Wales +custom_12:Yes +custom_13:Purple checksum:cs=' . $checksum . ' contact_id:' . $tokenData['contact_id'] . ' '; @@ -373,6 +384,18 @@ contact_id:' . $tokenData['contact_id'] . ' 'openid' => 'OpenID', 'world_region' => 'World Region', 'url' => 'http://civicrm.org', + $this->getCustomFieldName('text') => 'Bobsled', + $this->getCustomFieldName('select_string') => 'R', + $this->getCustomFieldName('select_date') => '2021-01-20', + $this->getCustomFieldName('int') => 999, + $this->getCustomFieldName('link') => 'http://civicrm.org', + $this->getCustomFieldName('country') => 'New Zealand', + $this->getCustomFieldName('multi_country') => ['France', 'Canada'], + $this->getCustomFieldName('contact_reference') => $this->individualCreate(['first_name' => 'Spider', 'last_name' => 'Man']), + $this->getCustomFieldName('state') => 'Queensland', + $this->getCustomFieldName('multi_state') => ['Victoria', 'New South Wales'], + $this->getCustomFieldName('boolean') => TRUE, + $this->getCustomFieldName('checkbox') => 'P', $this->getCustomFieldName('contact_reference') => $this->individualCreate(['first_name' => 'Spider', 'last_name' => 'Man']), 'checksum' => 'Checksum', 'contact_id' => $this->individualCreate(['first_name' => 'Peter', 'last_name' => 'Parker']), -- 2.25.1