There are 2 different methods in play for deleting contacts in tests. The one I'm removing uses a non-standard path & sometimes
causes loading issues when run in isolation, as well as being the less used.
Other functions could do with the same treatment.
Some unused vars removed too
);
$this->assertEquals($activityTypeId, 3, 'Verify activity type id is 3.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals($activities[$activityId]['subject'], 'Scheduling Meeting', 'Verify activity subject is correct.');
- Contact::delete($contactId);
- Contact::delete($targetContactId);
+ $this->contactDelete($contactId);
+ $this->contactDelete($targetContactId);
}
/**
$this->assertEquals($defaults['target_contact'][0], $targetContactId, 'Verify target contact id is correct.');
- Contact::delete($contactId);
- Contact::delete($targetContactId);
+ $this->contactDelete($contactId);
+ $this->contactDelete($targetContactId);
}
/**
'activity_type_id' => 2,
);
- $result = CRM_Activity_BAO_Activity::deleteActivity($params);
+ CRM_Activity_BAO_Activity::deleteActivity($params);
- $activityId = $this->assertDBNull('CRM_Activity_DAO_Activity', 'Scheduling Meeting', 'id',
+ $this->assertDBNull('CRM_Activity_DAO_Activity', 'Scheduling Meeting', 'id',
'subject', 'Database check for deleted activity.'
);
- Contact::delete($contactId);
- Contact::delete($targetContactId);
+ $this->contactDelete($contactId);
+ $this->contactDelete($targetContactId);
}
/**
'contact_id', 'Database check for deleted activity target.'
);
- Contact::delete($contactId);
- Contact::delete($targetContactId);
+ $this->contactDelete($contactId);
+ $this->contactDelete($targetContactId);
}
/**
'contact_id', 'Database check for deleted activity assignment.'
);
- Contact::delete($contactId);
- Contact::delete($assigneeContactId);
+ $this->contactDelete($contactId);
+ $this->contactDelete($assigneeContactId);
}
/**
$this->assertEquals($firstName, $contact->first_name, 'Check for updated first name.');
$contactId = $contact->id;
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
}
$this->assertAttributesEquals($checkPrefComm, $prefComm);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$contact = CRM_Contact_BAO_Contact::add($params);
$this->assertEquals($firstName, $contact->first_name, 'Check for updated first name.');
$contactId = $contact->id;
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
$householdName = 'Adams house';
$params = array(
);
$contact = CRM_Contact_BAO_Contact::add($params);
$this->assertEquals($householdName, $contact->sort_name, 'Check for updated household.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
$organizationName = 'My Organization';
$params = array(
);
$contact = CRM_Contact_BAO_Contact::add($params);
$this->assertEquals($organizationName, $contact->sort_name, 'Check for updated organization.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
CRM_Core_BAO_Note::cleanContactNotes($contactId);
// Cleanup DB by deleting the contact.
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
$this->quickCleanup(array('civicrm_contact', 'civicrm_note'));
}
//Now check values of Relationship type.
$this->assertEquals('Employee of', $val['relation'], 'Check for relationship type');
//delete the organization.
- Contact::delete(CRM_Utils_Array::value('contact_id_b', $val));
+ $this->contactDelete(CRM_Utils_Array::value('contact_id_b', $val));
}
//delete all notes related to contact
CRM_Core_BAO_Note::cleanContactNotes($contactId);
//cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
$this->quickCleanup(array('civicrm_contact'));
}
//Now check values of Relationship type.
$this->assertEquals('Employee of', $val['relation'], 'Check for relationship type');
//delete the organization.
- Contact::delete(CRM_Utils_Array::value('cid', $val));
+ $this->contactDelete(CRM_Utils_Array::value('cid', $val));
}
//Now check values of tag ids.
//Now check values of Relationship type.
$this->assertEquals('Employee of', $val['relation'], 'Check for relationship type');
//delete the organization.
- Contact::delete(CRM_Utils_Array::value('cid', $val));
+ $this->contactDelete(CRM_Utils_Array::value('cid', $val));
}
//Now check values of tag ids.
$this->assertAttributesEquals($updatePfParams['tag'], $tagIds);
//cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertAttributesEquals($compareParams, $contactDetails);
//cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
$this->quickCleanup(array('civicrm_contact'));
}
$this->assertEquals($email, CRM_Utils_Array::value('email', $params['email'][2]), 'Check Primary Email');
//cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
$this->quickCleanup(array('civicrm_contact'));
}
$this->assertEquals($openID, strtolower($params['openid'][2]['openid']), 'Check Primary OpenID');
//cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals($contactId, $match->contact_id, 'Check For Matching Contact');
//cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
$this->quickCleanup(array('civicrm_contact'));
}
$this->assertEquals($contactType, $params['contact_type'], 'Check For Contact Type');
//cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
$this->quickCleanup(array('civicrm_contact'));
}
$this->assertEquals($dbDisplayName, $paramsDisplayName, 'Check For Display Name');
//cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
$this->quickCleanup(array('civicrm_contact'));
}
$this->assertEquals($image, $checkImage, 'Check For Image');
//cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$prevTimestamps = $newTimestamps;
}
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
}
$this->contributionDelete($contribution->id);
//Delete Contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->contributionDelete($contribution->id);
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertDBNull('CRM_Contribute_DAO_Contribution', $contribution->trxn_id,
'id', 'trxn_id', 'Database check for deleted Contribution.'
);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
);
//Delete honor contact
- Contact::delete($honoreeContactId);
+ $this->contactDelete($honoreeContactId);
//Delete Contribution record
$this->contributionDelete($contribution->id);
//Delete contributor contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
//Delete Contribution
$this->contributionDelete($contribution->id);
//Delete Contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
//Delete Contribution
$this->contributionDelete($contribution->id);
//Delete Contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
// Delete Contribution
$this->contributionDelete($contribution->id);
// Delete Contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
// Delete Contribution
$this->contributionDelete($contribution->id);
// Delete Contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->contributionDelete($contribution->id);
//Delete Contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->contributionDelete($contribution->id);
//Delete Contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals($dao->amount, array_pop($amounts), 'Mismatch of amount proportionally assigned to financial item');
}
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
$block = CRM_Core_BAO_Address::create($params, $fixAddress, $entity = NULL);
- $cid = $this->assertDBNotNull('CRM_Core_DAO_Address', $contactId, 'id', 'contact_id',
+ $this->assertDBNotNull('CRM_Core_DAO_Address', $contactId, 'id', 'contact_id',
'Database check for updated address by contactId.'
);
- $addressId = $this->assertDBNotNull('CRM_Core_DAO_Address', '120 Terminal Road', 'id', 'street_address',
+ $this->assertDBNotNull('CRM_Core_DAO_Address', '120 Terminal Road', 'id', 'street_address',
'Database check for updated address by street_name.'
);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals($addAddress->geo_code_1, '31.694842', 'In line' . __LINE__);
$this->assertEquals($addAddress->geo_code_2, '-106.29998', 'In line' . __LINE__);
$this->assertEquals($addAddress->country_id, '1228', 'In line' . __LINE__);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals(count($allAddress), 2, 'Checking number of returned addresses.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals($allAddress, NULL, 'Checking null for returned addresses.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals($address[1]['id'], $addressId);
$this->assertEquals($address[1]['contact_id'], $contactId);
$this->assertEquals($address[1]['street_address'], 'Oberoi Garden');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
}
Custom::deleteGroup($customGroup);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
public function testCustomGroupMultipleDouble() {
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
public function testCustomGroupMultipleUpdate() {
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
public function testCustomGroupMultipleOldFormate() {
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
}
// Cleanup
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
/**
// Cleanup
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
}
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
/**
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
/**
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
/**
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
/**
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
/**
);
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
public function testCustomGroupMultiple() {
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
- Contact::delete($contactID);
+ $this->contactDelete($contactID);
}
}
);
$this->assertEquals($isBulkMail, 1, 'Verify bulkmail value is 1.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
public function testHoldEmail() {
$contactId = Contact::createIndividual();
- $params = array();
$params = array(
'email' => 'jane.doe@example.com',
'is_primary' => 1,
'Compare reset_date (' . $resetDate . ') in DB to current year.'
);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals('alan.smith1@example.com', $firstEmailValue[0]['email'], 'Confirm primary email address value.');
$this->assertEquals(1, $firstEmailValue[0]['is_primary'], 'Confirm first email address is primary.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
}
$isEditIM = $this->assertDBNotNull('CRM_Core_DAO_IM', $imId, 'name', 'id', 'Database check on updated IM name record.');
$this->assertEquals($isEditIM, 'doe.jane', 'Verify IM provider_id value is doe.jane.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals('alan1.smith1', $firstIMValue[0]['name'], 'Confirm primary IM value.');
$this->assertEquals(1, $firstIMValue[0]['is_primary'], 'Confirm first IM is primary.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
}
'Database check, Address created successfully.'
);
- //cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
//delete the location block
CRM_Core_BAO_Location::deleteLocBlock($locBlockId);
-
- //cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
//cleanup DB by deleting the record.
Event::delete($eventId);
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
}
/**
//cleanup DB by deleting the record.
Event::delete($eventId);
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
//Now check DB for Event
$this->assertDBNull('CRM_Event_DAO_Event', $eventId, 'id', 'id',
$this->assertAttributesEquals(CRM_Utils_Array::value('1', $params['im']),
CRM_Utils_Array::value('1', $values['im'])
);
-
- //cleanup DB by deleting the contact
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
}
$this->assertEquals(0, $openIds[$openIdTwo]['is_primary'], 'Confirm is_primary field value for second openid.');
$this->assertEquals(0, $openIds[$openIdTwo]['allowed_to_login'], 'Confirm allowed_to_login field value for second openid.');
- //Contact::delete($contactId);
$this->contactDelete($contactId);
$this->assertDBRowNotExist('CRM_Contact_DAO_Contact', $contactId);
}
"Check if phone field has expected value in updated record ( civicrm_phone.id={$phoneId} )."
);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals('(415) 222-1011 x 221', $firstPhoneValue[0]['phone'], "Confirm primary Phone value ( {$firstPhoneValue[0]['phone']} ).");
$this->assertEquals(1, $firstPhoneValue[0]['is_primary'], 'Confirm first Phone is primary.');
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
// so 1 pair for - first + last + mail
$this->assertEquals(count($foundDupes), 1, 'Check Individual-Fuzzy dupe rule for dupesInGroup().');
- // delete all created contacts
foreach ($contactIds as $contactId) {
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
// delete dupe group
$params = array('id' => $groupId, 'version' => 3);
// delete all created contacts
foreach ($contactIds as $contactId) {
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
}
}
}
+ /**
+ * Delete all created contacts.
+ */
public function deleteDupeContacts() {
- // delete all created contacts
foreach ($this->_contactIds as $contactId) {
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
// delete dupe group
'id', 3, 'Check DB for updated status id of the participant'
);
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
}
Participant::delete($participantId);
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
*/
public function testgetValuesWithoutValidParams() {
$params = $values = $ids = array();
- $participantId = Participant::create($this->_contactId, $this->_eventId);
+ Participant::create($this->_contactId, $this->_eventId);
$fetchParticipant = CRM_Event_BAO_Participant::getValues($params, $values, $ids);
$this->assertNull($fetchParticipant);
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
$this->assertEquals($eventFull, 'This event is full.', 'Checking if Event is full.');
Participant::delete($participantId);
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
$importableFields = CRM_Event_BAO_Participant::importableFields();
$this->assertNotEquals(count($importableFields), 0, 'Checking array not to be empty.');
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
$this->assertEquals($participantDetails['title'], $params['title'], 'Checking Event Title in which participant is enroled.');
Participant::delete($participantId);
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
'id', $this->_contactId, 'Check DB for contact of the participant'
);
- $deleteParticipant = CRM_Event_BAO_Participant::deleteParticipant($participant->id);
+ CRM_Event_BAO_Participant::deleteParticipant($participant->id);
$this->assertDBNull('CRM_Event_BAO_Participant', $participant->id, 'contact_id', 'id', 'Check DB for deleted Participant.');
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
$partidel[] = Participant::delete($partiId[$i]);
}
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
'contact_id', 'Check DB for deleted participant. Should be NULL.'
);
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
$exportableFields = CRM_Event_BAO_Participant::exportableFields();
$this->assertNotEquals(count($exportableFields), 0, 'Checking array not to be empty.');
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($this->_eventId);
}
CRM_Event_BAO_Participant::fixEventLevel($values[$participant->id]['fee_level']);
}
- $deletePricefield = CRM_Price_BAO_PriceField::deleteField($pricefield->id);
+ CRM_Price_BAO_PriceField::deleteField($pricefield->id);
$this->assertDBNull('CRM_Price_BAO_PriceField', $pricefield->id, 'name',
'id', 'Check DB for non-existence of Price Field.'
);
- $deletePriceset = CRM_Price_BAO_PriceSet::deleteSet($priceset->id);
+ CRM_Price_BAO_PriceSet::deleteSet($priceset->id);
$this->assertDBNull('CRM_Price_BAO_PriceSet', $priceset->id, 'title',
'id', 'Check DB for non-existence of Price Set.'
);
Participant::delete($participant->id);
- Contact::delete($this->_contactId);
+ $this->contactDelete($this->_contactId);
Event::delete($eventId);
}
public function tearDown() {
$this->membershipTypeDelete(array('id' => $this->_membershipTypeID));
$this->membershipStatusDelete($this->_membershipStatusID);
- Contact::delete($this->_contactID);
+ $this->contactDelete($this->_contactID);
$this->_contactID = $this->_membershipStatusID = $this->_membershipTypeID = NULL;
}
$this->assertEquals($membershipTypeId, $this->_membershipTypeID, 'Verify membership type id is fetched.');
$this->membershipDelete($membershipId);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
public function testGetValues() {
$this->membershipDelete($membershipId1);
$this->membershipDelete($membershipId2);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
public function testRetrieve() {
$this->membershipDelete($membershipId1);
$this->membershipDelete($membershipId2);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
public function testDeleteMembership() {
);
CRM_Member_BAO_Membership::del($membershipId);
- $membershipId = $this->assertDBNull('CRM_Member_BAO_Membership', $contactId, 'id',
+ $this->assertDBNull('CRM_Member_BAO_Membership', $contactId, 'id',
'contact_id', 'Database check for deleted membership.'
);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
public function testGetContactMembership() {
$this->assertEquals($membership['id'], $membershipId, 'Verify membership record is retrieved.');
$this->membershipDelete($membershipId);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
$membership[$membershipId]['renewPageId'] = CRM_Member_BAO_Membership::getContributionPageId($membershipId);
$this->membershipDelete($membershipId);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
CRM_Member_BAO_Membership::getMembershipStarts($this->_membershipTypeID, $yearStart, $currentDate);
$this->membershipDelete($membershipId);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
CRM_Member_BAO_Membership::getMembershipCount($this->_membershipTypeID, $currentDate, $test);
$this->membershipDelete($membershipId);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
);
$this->membershipDelete($membershipId);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
CRM_Member_BAO_Membership::deleteRelatedMemberships($membershipId);
$this->membershipDelete($membershipId);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
$this->assertEquals($endDate, $MembershipRenew->end_date, 'Verify correct end date is calculated after membership renewal');
$this->membershipDelete($membershipId);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
/**
);
$this->membershipDelete($membershipId);
- Contact::delete($contactId);
+ $this->contactDelete($contactId);
}
}
return $organization->id;
}
- /**
- * Helper function to delete a contact.
- *
- * @param int $contactID
- * Id of the contact to delete.
- * @return bool
- * true if contact deleted, false otherwise
- */
- public static function delete($contactID) {
- require_once 'CRM/Contact/BAO/Contact.php';
- return CRM_Contact_BAO_Contact::deleteContact($contactID);
- }
-
}