From 83aa0e630490d90fb24f097d86a254bd09bae0ff Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Fri, 8 Nov 2019 18:10:21 -0500 Subject: [PATCH] dev/core#1378 Scheduled reminders: test for contact w/ good and bad email --- .../CRM/Activity/ActionMappingTest.php | 27 +++++++++++++++++++ .../ActionSchedule/AbstractMappingTest.php | 10 +++++++ 2 files changed, 37 insertions(+) diff --git a/tests/phpunit/CRM/Activity/ActionMappingTest.php b/tests/phpunit/CRM/Activity/ActionMappingTest.php index 2ec8b7d171..fe7036db3a 100644 --- a/tests/phpunit/CRM/Activity/ActionMappingTest.php +++ b/tests/phpunit/CRM/Activity/ActionMappingTest.php @@ -149,6 +149,19 @@ class CRM_Activity_ActionMappingTest extends \Civi\ActionSchedule\AbstractMappin [], ]; + // Gretchen has one email on hold, but her primary email is not on hold. + $cs[] = [ + '2015-02-01 00:00:00', + 'addGretchenMeeting scheduleForMeeting startOnTime useHelloFirstName recipientIsActivitySource', + [ + [ + 'time' => '2015-02-01 00:00:00', + 'to' => ['gretchen@example.org'], + 'subject' => '/Hello, Gretchen.*via subject/', + ], + ], + ]; + return $cs; } @@ -225,6 +238,20 @@ class CRM_Activity_ActionMappingTest extends \Civi\ActionSchedule\AbstractMappin ]); } + /** + * Create an activity record for Gretchen with type "Meeting". + */ + public function addGretchenMeeting() { + $this->callAPISuccess('Activity', 'create', [ + 'source_contact_id' => $this->contacts['gretchen']['id'], + 'activity_type_id' => 'Meeting', + 'subject' => 'Subject for Gretchen', + 'activity_date_time' => date('Y-m-d H:i:s', strtotime($this->targetDate)), + 'status_id' => 2, + 'assignee_contact_id' => [$this->contacts['carol']['id']], + ]); + } + /** * Schedule message delivery for activities of type "Meeting". */ diff --git a/tests/phpunit/Civi/ActionSchedule/AbstractMappingTest.php b/tests/phpunit/Civi/ActionSchedule/AbstractMappingTest.php index e30b2bb756..be9a4501a5 100644 --- a/tests/phpunit/Civi/ActionSchedule/AbstractMappingTest.php +++ b/tests/phpunit/Civi/ActionSchedule/AbstractMappingTest.php @@ -250,6 +250,16 @@ abstract class AbstractMappingTest extends \CiviUnitTestCase { 'on_hold' => 1, ], ]); + $this->contacts['gretchen'] = $this->callAPISuccess('Contact', 'create', [ + 'contact_type' => 'Individual', + 'first_name' => 'Gretchen', + 'last_name' => 'Exemplar', + 'email' => 'gretchen@example.org', + 'api.Email.create' => [ + 'email' => 'gratchen@example.org', + 'on_hold' => 1, + ], + ]); } /** -- 2.25.1