From 9d7f4cd248ad1fe4db450e332ec20decb2da47e7 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 5 Oct 2021 14:20:15 -0700 Subject: [PATCH] RecurringEdit - Split examples --- ...ditExample.ex.php => AlexCancelled.ex.php} | 4 +- .../RecurringEdit/BarbPending.ex.php | 29 ++++++ Civi/Test/ExampleData/Contact/Barb.ex.php | 91 +++++++++++++++++++ 3 files changed, 122 insertions(+), 2 deletions(-) rename CRM/Contribute/WorkflowMessage/RecurringEdit/{BasicEditExample.ex.php => AlexCancelled.ex.php} (83%) create mode 100644 CRM/Contribute/WorkflowMessage/RecurringEdit/BarbPending.ex.php create mode 100644 Civi/Test/ExampleData/Contact/Barb.ex.php diff --git a/CRM/Contribute/WorkflowMessage/RecurringEdit/BasicEditExample.ex.php b/CRM/Contribute/WorkflowMessage/RecurringEdit/AlexCancelled.ex.php similarity index 83% rename from CRM/Contribute/WorkflowMessage/RecurringEdit/BasicEditExample.ex.php rename to CRM/Contribute/WorkflowMessage/RecurringEdit/AlexCancelled.ex.php index f560e73e85..057244938a 100644 --- a/CRM/Contribute/WorkflowMessage/RecurringEdit/BasicEditExample.ex.php +++ b/CRM/Contribute/WorkflowMessage/RecurringEdit/AlexCancelled.ex.php @@ -1,12 +1,12 @@ "workflow/{$this->wfName}/{$this->exName}", // This title is not very clear. When we have some more examples to compare against, feel free to change/clarify. - 'title' => ts('Recurring Edit: Basic Example'), + 'title' => ts('Recurring Edit: Alex, Cancelled'), 'tags' => ['preview', 'phpunit'], ]; } diff --git a/CRM/Contribute/WorkflowMessage/RecurringEdit/BarbPending.ex.php b/CRM/Contribute/WorkflowMessage/RecurringEdit/BarbPending.ex.php new file mode 100644 index 0000000000..d6df8cb69a --- /dev/null +++ b/CRM/Contribute/WorkflowMessage/RecurringEdit/BarbPending.ex.php @@ -0,0 +1,29 @@ + "workflow/{$this->wfName}/{$this->exName}", + // This title is not very clear. When we have some more examples to compare against, feel free to change/clarify. + 'title' => ts('Recurring Edit: Barbara, Pending'), + 'tags' => ['preview'], + ]; + } + + public function build(array &$example): void { + $msg = (new CRM_Contribute_WorkflowMessage_RecurringEdit()) + ->setReceiptFromEmail('info@example.com') + ->setContact(\Civi\Test::example('entity/Contact/Barb')) + ->setContributionRecur(\Civi\Test::example('entity/ContributionRecur/Euro5990/pending')); + $example['data'] = $this->toArray($msg); + + $example['asserts'] = [ + 'default' => [ + ['for' => 'subject', 'regex' => '/Recurring Contribution Update.*Barb/'], + ['for' => 'text', 'regex' => '/Recurring contribution is for € 5,990.99, every 2 year.s. for 24 installments/'], + ], + ]; + } + +} diff --git a/Civi/Test/ExampleData/Contact/Barb.ex.php b/Civi/Test/ExampleData/Contact/Barb.ex.php new file mode 100644 index 0000000000..015b6a0e9d --- /dev/null +++ b/Civi/Test/ExampleData/Contact/Barb.ex.php @@ -0,0 +1,91 @@ + "entity/{$this->entityName}/{$this->exName}", + ]; + } + + public function build(array &$example): void { + $example['data'] = [ + 'contact_id' => '100', + 'contact_type' => 'Individual', + 'contact_sub_type' => NULL, + 'sort_name' => 'Johnson, Barbara', + 'display_name' => 'Barbara Johnson', + 'do_not_email' => '1', + 'do_not_phone' => '1', + 'do_not_mail' => '0', + 'do_not_sms' => '0', + 'do_not_trade' => '0', + 'is_opt_out' => '0', + 'legal_identifier' => NULL, + 'external_identifier' => NULL, + 'nick_name' => 'Barb', + 'legal_name' => NULL, + 'image_URL' => NULL, + 'preferred_communication_method' => NULL, + 'preferred_language' => NULL, + 'preferred_mail_format' => 'Both', + 'first_name' => 'Barbara', + 'middle_name' => '', + 'last_name' => 'Johnson', + 'prefix_id' => '4', + 'suffix_id' => NULL, + 'formal_title' => NULL, + 'communication_style_id' => NULL, + 'job_title' => NULL, + 'gender_id' => '1', + 'birth_date' => '1999-05-11', + 'is_deceased' => '0', + 'deceased_date' => NULL, + 'household_name' => NULL, + 'organization_name' => NULL, + 'sic_code' => NULL, + 'contact_is_deleted' => '0', + 'current_employer' => NULL, + 'address_id' => NULL, + 'street_address' => NULL, + 'supplemental_address_1' => NULL, + 'supplemental_address_2' => NULL, + 'supplemental_address_3' => NULL, + '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', + 'phone_type_id' => '1', + 'phone' => '393-7924', + 'email_id' => '7', + 'email' => 'barb@testing.net', + 'on_hold' => '0', + 'im_id' => NULL, + 'provider_id' => NULL, + 'im' => NULL, + 'worldregion_id' => NULL, + 'world_region' => NULL, + 'languages' => NULL, + 'individual_prefix' => NULL, + 'individual_suffix' => NULL, + 'communication_style' => NULL, + 'gender' => 'Female', + 'state_province_name' => NULL, + 'state_province' => NULL, + 'country' => NULL, + 'email_greeting_id' => 1, + 'email_greeting_custom' => NULL, + 'email_greeting_display' => 'Dear Barb', + 'postal_greeting_id' => 1, + 'postal_greeting_custom' => NULL, + 'postal_greeting_display' => 'Dear Barb', + ]; + } + +} -- 2.25.1