From 09d21a209d478e53766be1ae48d6de37cca8e76f Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 19 Aug 2022 19:22:17 +1200 Subject: [PATCH] Update Alex demo data to have email_greeting value --- Civi/Test/ExampleData/Contact/Alex.php | 23 ++++++------------- .../Case/WorkflowMessage/CaseActivityTest.php | 2 +- .../CRM/Upgrade/Incremental/BaseTest.php | 4 ++-- .../phpunit/api/v4/Entity/ExampleDataTest.php | 2 +- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/Civi/Test/ExampleData/Contact/Alex.php b/Civi/Test/ExampleData/Contact/Alex.php index ebb2e78296..b6f00fdf16 100644 --- a/Civi/Test/ExampleData/Contact/Alex.php +++ b/Civi/Test/ExampleData/Contact/Alex.php @@ -12,11 +12,17 @@ class Alex extends \Civi\Test\EntityExample { public function build(array &$example): void { $example['data'] = [ - 'contact_id' => '100', + 'id' => '100', + 'first_name' => 'Alex', + 'middle_name' => '', + 'last_name' => 'D\u00edaz', 'contact_type' => 'Individual', 'contact_sub_type' => NULL, 'sort_name' => 'D\u00edaz, Alex', 'display_name' => 'Dr. Alex D\u00edaz', + 'prefix_id:label' => 'Dr.', + 'gender_id:label' => 'Female', + 'email_greeting_display' => 'Dear Alex', 'do_not_email' => '1', 'do_not_phone' => '1', 'do_not_mail' => '0', @@ -30,16 +36,9 @@ class Alex extends \Civi\Test\EntityExample { 'image_URL' => NULL, 'preferred_communication_method' => NULL, 'preferred_language' => NULL, - 'preferred_mail_format' => 'Both', - 'first_name' => 'Alex', - 'middle_name' => '', - 'last_name' => 'D\u00edaz', - 'prefix_id' => '4', - 'suffix_id' => NULL, 'formal_title' => NULL, 'communication_style_id' => NULL, 'job_title' => NULL, - 'gender_id' => '1', 'birth_date' => '1994-04-21', 'is_deceased' => '0', 'deceased_date' => NULL, @@ -56,8 +55,6 @@ class Alex extends \Civi\Test\EntityExample { 'city' => NULL, 'postal_code_suffix' => NULL, 'postal_code' => NULL, - 'geo_code_1' => NULL, - 'geo_code_2' => NULL, 'state_province_id' => NULL, 'country_id' => NULL, 'phone_id' => '7', @@ -65,17 +62,11 @@ class Alex extends \Civi\Test\EntityExample { 'phone' => '293-6934', 'email_id' => '7', 'email' => 'daz.alex67@testing.net', - 'on_hold' => '0', 'im_id' => NULL, 'provider_id' => NULL, 'im' => NULL, 'worldregion_id' => NULL, 'world_region' => NULL, - 'languages' => NULL, - 'individual_prefix' => 'Dr.', - 'individual_suffix' => NULL, - 'communication_style' => NULL, - 'gender' => 'Female', 'state_province_name' => NULL, 'state_province' => NULL, 'country' => NULL, diff --git a/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivityTest.php b/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivityTest.php index ce34bc710a..0ecb327b65 100644 --- a/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivityTest.php +++ b/tests/phpunit/CRM/Case/WorkflowMessage/CaseActivityTest.php @@ -71,7 +71,7 @@ class CRM_Case_WorkflowMessage_CaseActivityTest extends CiviUnitTestCase { ->execute() ->single(); $this->assertEquals($name, $get['name']); - $this->assertEquals(100, $get['data']['modelProps']['contact']['contact_id']); + $this->assertEquals(100, $get['data']['modelProps']['contact']['id']); $this->assertEquals('myrole', $get['data']['modelProps']['contact']['role']); } diff --git a/tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php b/tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php index 544f1be597..e8fe82dd3f 100644 --- a/tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php +++ b/tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php @@ -33,7 +33,7 @@ class CRM_Upgrade_Incremental_BaseTest extends CiviUnitTestCase { foreach ($templates as $template) { $msg_text = $this->callAPISuccessGetValue('MessageTemplate', ['id' => $template['id'], 'return' => 'msg_text']); - $this->assertStringContainsString('{assign var="greeting" value="{contact.email_greeting}"}{if $greeting}{$greeting},{/if}', $msg_text); + $this->assertStringContainsString('{assign var="greeting" value="{contact.email_greeting_display}"}{if $greeting}{$greeting},{/if}', $msg_text); if ($msg_text !== $originalText) { // Reset value for future tests. $this->callAPISuccess('MessageTemplate', 'create', ['msg_text' => $originalText, 'id' => $template['id']]); @@ -116,7 +116,7 @@ class CRM_Upgrade_Incremental_BaseTest extends CiviUnitTestCase { foreach ($templates as $template) { $msg_text = $this->callAPISuccessGetValue('MessageTemplate', ['id' => $template['id'], 'return' => 'msg_text']); if ($template['is_reserved']) { - $this->assertStringContainsString('{assign var="greeting" value="{contact.email_greeting}"}{if $greeting}{$greeting},{/if}', $msg_text); + $this->assertStringContainsString('{assign var="greeting" value="{contact.email_greeting_display}"}{if $greeting}{$greeting},{/if}', $msg_text); } else { $this->assertEquals('great what a silly sausage you are', $msg_text); diff --git a/tests/phpunit/api/v4/Entity/ExampleDataTest.php b/tests/phpunit/api/v4/Entity/ExampleDataTest.php index e7d3d73a38..ba1f696a59 100644 --- a/tests/phpunit/api/v4/Entity/ExampleDataTest.php +++ b/tests/phpunit/api/v4/Entity/ExampleDataTest.php @@ -60,7 +60,7 @@ class ExampleDataTest extends Api4TestBase { ->execute() ->single(); $this->assertEquals($name, $get['name']); - $this->assertEquals(100, $get['data']['modelProps']['contact']['contact_id']); + $this->assertEquals(100, $get['data']['modelProps']['contact']['id']); } } -- 2.25.1