'source_record_id' => $this->mailing_id,
'activity_date_time' => $job_date,
'subject' => $mailing->subject,
- 'status_id' => 2,
+ 'status_id' => 'Completed',
'deleteActivityTarget' => FALSE,
'campaign_id' => $mailing->campaign_id,
];
}
}
- if (is_a(CRM_Activity_BAO_Activity::create($activity), 'CRM_Core_Error')) {
+ try {
+ civicrm_api3('Activity', 'create', $activity);
+ }
+ catch (Exception $e) {
$result = FALSE;
}
parent::testHtmlWithOpenAndUrlTracking();
}
+ /**
+ * Test to check Activity being created on mailing Job.
+ *
+ */
+ public function testMailingActivityCreate() {
+ $subject = uniqid('testMailingActivityCreate');
+ $this->runMailingSuccess([
+ 'subject' => $subject,
+ 'body_html' => 'Test Mailing Activity Create',
+ 'scheduled_id' => $this->individualCreate(),
+ ]);
+
+ $this->callAPISuccessGetCount('activity', [
+ 'activity_type_id' => 'Bulk Email',
+ 'status_id' => 'Completed',
+ 'subject' => $subject,
+ ], 1);
+ }
+
}