CRM-18233 Fix modified_date action schedule test
authoreileenmcnaugton <eileen@fuzion.co.nz>
Mon, 14 Mar 2016 09:19:51 +0000 (22:19 +1300)
committereileenmcnaugton <eileen@fuzion.co.nz>
Mon, 14 Mar 2016 09:24:07 +0000 (22:24 +1300)
tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php

index 6e46bfe5e9adcbab1846e665ef98647455a95d6e..75d65ed1b6d324f1a070a074e1f826e268cad544 100644 (file)
@@ -1186,6 +1186,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase {
   public function testContactModifiedAnniversary() {
     $contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
     $this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
+    $modifiedDate = $this->callAPISuccess('Contact', 'getvalue', array('id' => $contact['id'], 'return' => 'modified_date'));
     $actionSchedule = $this->fixtures['sched_contact_mod_anniv'];
     $actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
     $this->assertTrue(is_numeric($actionScheduleDao->id));
@@ -1197,7 +1198,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase {
       ),
       array(
         // On the eve of 3 years after they were modified, send an email.
-        'time' => date('Y-m-d H:i:s', strtotime($contact['values'][$contact['id']]['modified_date'] . ' +3 years -23 hours')),
+        'time' => date('Y-m-d H:i:s', strtotime($modifiedDate . ' +3 years -1 day')),
         'recipients' => array(array('test-bday@example.com')),
       ),
     ));