From: eileen Date: Tue, 12 Apr 2016 00:31:58 +0000 (+1200) Subject: Fix for frequently failing api_v3_JobTest::testCallSendReminderLimitTo test. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a60ba2b38953dd18efc869ed5de6bba4e8d68c28;p=civicrm-core.git Fix for frequently failing api_v3_JobTest::testCallSendReminderLimitTo test. The issue is that the test sets the membership with a join date in one hour's time. For 23 hours of the day the join date is on the same date as 'today' but for one hour it is not, and there is no valid status in a default set up for the period before the join date, hence we get an error Change-Id: I3fb8a70e774b2ed70e857808911628ec5ce5cd79 --- diff --git a/tests/phpunit/api/v3/JobTest.php b/tests/phpunit/api/v3/JobTest.php index 9284eb7fab..159f26e6eb 100644 --- a/tests/phpunit/api/v3/JobTest.php +++ b/tests/phpunit/api/v3/JobTest.php @@ -247,24 +247,25 @@ class api_v3_JobTest extends CiviUnitTestCase { $this->callAPISuccess('membership', 'create', array( 'contact_id' => $contactID, 'membership_type_id' => $membershipTypeID, - 'join_date' => '+ 1 hour', + 'join_date' => 'now', + 'start_date' => '+ 1 hour', ) ); } } - $result = $this->callAPISuccess('action_schedule', 'create', array( + $this->callAPISuccess('action_schedule', 'create', array( 'title' => " remind all Texans", 'subject' => "drawling renewal", 'entity_value' => $membershipTypeID, 'mapping_id' => 4, - 'start_action_date' => 'membership_join_date', + 'start_action_date' => 'membership_start_date', 'start_action_offset' => 0, 'start_action_condition' => 'before', 'start_action_unit' => 'hour', 'group_id' => $groupID, 'limit_to' => TRUE, )); - $result = $this->callAPISuccess('job', 'send_reminder', array()); + $this->callAPISuccess('job', 'send_reminder', array()); $successfulCronCount = CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_action_log"); $this->assertEquals($successfulCronCount, 1); $sentToID = CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM civicrm_action_log");