Fix for frequently failing api_v3_JobTest::testCallSendReminderLimitTo test.
authoreileen <emcnaughton@wikimedia.org>
Tue, 12 Apr 2016 00:31:58 +0000 (12:31 +1200)
committereileen <emcnaughton@wikimedia.org>
Tue, 12 Apr 2016 00:32:04 +0000 (12:32 +1200)
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

tests/phpunit/api/v3/JobTest.php

index 9284eb7fabd9177d65a741c9aaa0b7b300db8f15..159f26e6eb93c749d873762db4d2cb90837d6709 100644 (file)
@@ -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");