*
* @throws CRM_Core_Exception
*/
- public function setUp() {
+ public function setUp(): void {
parent::setUp();
$this->mut = new CiviMailUtils($this, TRUE);
'status_id' => '8',
];
- $this->fixtures['phonecall'] = [
+ $this->fixtures['phone_call'] = [
'status_id' => 1,
'activity_type_id' => 2,
'activity_date_time' => '20120615100000',
*
* @throws \CRM_Core_Exception
*/
- public function tearDown() {
+ public function tearDown(): void {
parent::tearDown();
$this->mut->clearMessages();
$this->mut->stop();
*
* @return array
*/
- public function mailerExamples() {
+ public function mailerExamples(): array {
$cases = [];
// Some tokens - short as subject has 128char limit in DB.
* @dataProvider mailerExamples
*
*/
- public function testMailer($schedule, $patterns) {
+ public function testMailer($schedule, $patterns): void {
$actionSchedule = array_merge($this->fixtures['sched_activity_1day'], $schedule);
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
$this->assertInternalType('numeric', $actionScheduleDao->id);
- $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phonecall']);
+ $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phone_call']);
$this->assertInternalType('numeric', $activity->id);
$contact = $this->callAPISuccess('contact', 'create', array_merge(
$this->fixtures['contact'],
*
* @throws \CRM_Core_Exception
*/
- public function testActivityDateTimeMatchNonRepeatableSchedule() {
+ public function testActivityDateTimeMatchNonRepeatableSchedule(): void {
$this->createScheduleFromFixtures('sched_activity_1day');
- $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phonecall']);
+ $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phone_call']);
$this->assertInternalType('numeric', $activity->id);
$contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']);
- $activity->subject = 'Test subject for Phonecall';
+ $activity->subject = 'Test subject for phone_call';
$activity->save();
$source['contact_id'] = $contact['id'];
*
* @throws \CRM_Core_Exception
*/
- public function testActivityDateTimeMatchRepeatableSchedule() {
+ public function testActivityDateTimeMatchRepeatableSchedule(): void {
$this->createScheduleFromFixtures('sched_activity_1day_r');
- $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phonecall']);
+ $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phone_call']);
$this->assertTrue(is_numeric($activity->id));
$contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']);
$activity->save();
$this->assertCronRuns([
[
// Before the 24-hour mark, no email
- 'time' => '012-06-14 04:00:00',
+ 'time' => '2012-06-14 04:00:00',
'recipients' => [],
'subjects' => [],
],
/**
* @throws \CRM_Core_Exception
*/
- public function testActivityDateTimeMatchRepeatableScheduleOnAbsDate() {
+ public function testActivityDateTimeMatchRepeatableScheduleOnAbsDate(): void {
$this->createScheduleFromFixtures('sched_activity_1day_r_on_abs_date');
- $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phonecall']);
+ $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phone_call']);
$this->assertInternalType('numeric', $activity->id);
$contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']);
$activity->save();
*
* @throws \CRM_Core_Exception
*/
- public function testEventNameWithAbsoluteDateAndNothingElse() {
+ public function testEventNameWithAbsoluteDateAndNothingElse(): void {
$participant = $this->createTestObject('CRM_Event_DAO_Participant', array_merge($this->fixtures['participant'], ['status_id' => 1]));
$this->callAPISuccess('Email', 'create', [
'contact_id' => $participant->contact_id,
*
* @throws \CRM_Core_Exception
*/
- public function testMembershipDateMatch() {
+ public function testMembershipDateMatch(): void {
$membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], ['status_id' => 1]));
$this->assertInternalType('numeric', $membership->id);
$this->callAPISuccess('Email', 'create', [
* CRM-21675: Support parent and smart group in 'Limit to' field
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function testScheduleReminderWithParentGroup() {
+ public function testScheduleReminderWithParentGroup(): void {
// Contact A with birth-date at '07-07-2005' and gender - Male, later got added in smart group
$this->individualCreate(['birth_date' => '20050707', 'gender_id' => 1, 'email' => 'abc@test.com']);
// Contact B with birth-date at '07-07-2005', later got added in regular group
* an email should be sent.
*
* @throws \API_Exception
+ * @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
- public function testMembershipJoinDateNonMatch() {
+ public function testMembershipJoinDateNonMatch(): void {
$this->createMembershipFromFixture('rolling_membership', '', ['email' => 'test-member@example.com']);
// Add an alternative membership type, and only send messages for that type
$extraMembershipType = $this->createTestObject('CRM_Member_DAO_MembershipType', []);
/**
* Test that the first and SECOND notifications are sent out.
*
+ * @throws \API_Exception
* @throws \CRM_Core_Exception
*/
- public function testMembershipEndDateRepeat() {
+ public function testMembershipEndDateRepeat(): void {
// creates membership with end_date = 20120615
$membership = $this->createMembershipFromFixture('rolling_membership', 'Current');
$this->callAPISuccess('Email', 'create', [
* between
* see CRM-15376
*
+ * @throws \API_Exception
* @throws \CRM_Core_Exception
*/
- public function testMembershipEndDateRepeatChangedEndDate_CRM_15376() {
+ public function testMembershipEndDateRepeatChangedEndDate_CRM_15376(): void {
// creates membership with end_date = 20120615
$membership = $this->createMembershipFromFixture('rolling_membership', 'Current');
$this->callAPISuccess('Email', 'create', [
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
- public function testMembershipEndDateMatch() {
+ public function testMembershipEndDateMatch(): void {
// creates membership with end_date = 20120615
$membership = $this->createMembershipFromFixture('rolling_membership', 'Current');
$this->callAPISuccess('Email', 'create', [
*
* @throws \CRM_Core_Exception
*/
- public function testMultipleMembershipEndDateMatch() {
+ public function testMultipleMembershipEndDateMatch(): void {
$membershipTypeId = $this->membershipTypeCreate($this->fixtures['rolling_membership']['membership_type_id']);
$membershipOne = $this->createMembershipAndContact($this->fixtures['contact'], $membershipTypeId);
$membershipTwo = $this->createMembershipAndContact($this->fixtures['contact_2'], $membershipTypeId);
* For contacts/members which match schedule based on end date,
* an email should be sent.
*
+ * @throws \API_Exception
* @throws \CRM_Core_Exception
*/
- public function testMembershipEndDateNoMatch() {
+ public function testMembershipEndDateNoMatch(): void {
// creates membership with end_date = 20120615
$membership = $this->createMembershipFromFixture('rolling_membership', 'Grace');
$this->callAPISuccess('Email', 'create', [
/**
* @throws \CRM_Core_Exception
*/
- public function testContactBirthDateNoAnniv() {
+ public function testContactBirthDateNoAnniv(): void {
$contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
$this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
$actionSchedule = $this->fixtures['sched_contact_bday_yesterday'];
/**
* @throws \CRM_Core_Exception
*/
- public function testContactBirthDateAnniversary() {
+ public function testContactBirthDateAnniversary(): void {
$contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
$this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
$actionSchedule = $this->fixtures['sched_contact_bday_anniv'];
/**
* @throws \CRM_Core_Exception
*/
- public function testContactCustomDateNoAnniversary() {
+ public function testContactCustomDateNoAnniversary(): void {
$group = [
'title' => 'Test_Group',
'name' => 'test_group',
/**
* @throws \CRM_Core_Exception
*/
- public function testContactCreatedNoAnniversary() {
+ public function testContactCreatedNoAnniversary(): void {
$contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
$this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
$this->createScheduleFromFixtures('sched_contact_created_yesterday');
*
* @throws \CRM_Core_Exception
*/
- public function testContactModifiedAnniversary() {
+ public function testContactModifiedAnniversary(): void {
$contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
$this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
$modifiedDate = $this->callAPISuccess('Contact', 'getvalue', ['id' => $contact['id'], 'return' => 'modified_date']);
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
- public function testMembershipLimitToNone() {
+ public function testMembershipLimitToNone(): void {
// creates membership with end_date = 20120615
$membership = $this->createMembershipFromFixture('rolling_membership', 'Current');
$result = $this->callAPISuccess('Email', 'create', [
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
- public function testMembershipWithReferenceDate() {
+ public function testMembershipWithReferenceDate(): void {
$membership = $this->createMembershipFromFixture('rolling_membership', 'Current', ['email' => 'member@example.com']);
$this->callAPISuccess('contact', 'create', array_merge($this->fixtures['contact'], ['contact_id' => $membership->contact_id]));
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
- public function testMembershipOnMultipleReminder() {
+ public function testMembershipOnMultipleReminder(): void {
$membership = $this->createMembershipFromFixture('rolling_membership', 'Current', ['email' => 'member@example.com']);
$this->callAPISuccess('contact', 'create', array_merge($this->fixtures['contact'], ['contact_id' => $membership->contact_id]));
*
* @throws \CRM_Core_Exception
*/
- public function testContactCustomDate_Anniversary() {
+ public function testContactCustomDate_Anniversary(): void {
$group = [
'title' => 'Test_Group now',
'name' => 'test_group_now',
* Test sched reminder set via registration date.
*
* @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function testEventTypeRegistrationDate() {
+ public function testEventTypeRegistrationDate(): void {
$contact = $this->individualCreate(['email' => 'test-event@example.com']);
//Add it as a participant to an event ending registration - 7 days from now.
$params = [
*
* @throws \CRM_Core_Exception
*/
- public function testEventTypeStartDate() {
+ public function testEventTypeStartDate(): void {
// Create event+participant with start_date = 20120315, end_date = 20120615.
$participant = $this->createTestObject('CRM_Event_DAO_Participant', array_merge($this->fixtures['participant'], ['status_id' => 2]));
$this->callAPISuccess('Email', 'create', [
*
* @throws \CRM_Core_Exception
*/
- public function testEventTypeEndDateRepeat() {
+ public function testEventTypeEndDateRepeat(): void {
// Create event+participant with start_date = 20120315, end_date = 20120615.
$participant = $this->createTestObject('CRM_Event_DAO_Participant', array_merge($this->fixtures['participant'], ['status_id' => 2]));
$this->callAPISuccess('Email', 'create', [
*
* @throws \CRM_Core_Exception
*/
- public function assertCronRuns($cronRuns) {
+ public function assertCronRuns($cronRuns): void {
foreach ($cronRuns as $cronRun) {
CRM_Utils_Time::setTime($cronRun['time']);
$this->callAPISuccess('job', 'send_reminder', []);
*
* This method is called before a test is executed.
*/
- protected function _setUp() {
+ protected function _setUp(): void {
$this->_testObjects = [];
}
*
* This method is called after a test is executed.
*/
- protected function _tearDown() {
+ protected function _tearDown(): void {
parent::tearDown();
$this->deleteTestObjects();
}
* @param array $objects
* DAO or BAO objects.
*/
- public function registerTestObjects($objects) {
+ public function registerTestObjects($objects): void {
//if (is_object($objects)) {
// $objects = array($objects);
//}
}
}
- public function deleteTestObjects() {
+ public function deleteTestObjects(): void {
// Note: You might argue that the FK relations between test
// objects could make this problematic; however, it should
// behave intuitively as long as we mentally split our
* Test that the various repetition units work correctly.
* @see https://issues.civicrm.org/jira/browse/CRM-17028
*/
- public function testRepetitionFrequencyUnit() {
+ public function testRepetitionFrequencyUnit(): void {
$membershipTypeParams = [
'duration_interval' => '1',
'duration_unit' => 'year',
*
* @throws \CRM_Core_Exception
*/
- public function testInheritedMembershipPermissions() {
+ public function testInheritedMembershipPermissions(): void {
// Set up common parameters for memberships.
$membershipParams = $this->fixtures['rolling_membership'];
$membershipParams['status_id'] = 1;
*
* @return DateTime
*/
- public function createModifiedDateTime($origDateTime, $modifyRule) {
+ public function createModifiedDateTime($origDateTime, $modifyRule): \DateTime {
$newDateTime = clone($origDateTime);
$newDateTime->modify($modifyRule);
return $newDateTime;
/**
* Test absolute date handling for membership.
*
+ * @throws \API_Exception
* @throws \CRM_Core_Exception
*/
- public function testMembershipScheduleWithAbsoluteDate() {
+ public function testMembershipScheduleWithAbsoluteDate(): void {
$membership = $this->createMembershipFromFixture('rolling_membership', 'New', [
'email' => 'test-member@example.com',
'location_type_id' => 1,
* @throws \API_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
- protected function createMembershipFromFixture($fixture, $status, $emailParams = []) {
+ protected function createMembershipFromFixture($fixture, $status, $emailParams = []): \CRM_Member_DAO_Membership {
/* @var CRM_Member_DAO_Membership $membership */
$membership = $this->createTestObject(
'CRM_Member_DAO_Membership',
*
* @param string $fixture
*/
- protected function createScheduleFromFixtures($fixture) {
+ protected function createScheduleFromFixtures($fixture): void {
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($this->fixtures[$fixture]);
$this->assertInternalType('numeric', $actionScheduleDao->id);
}