/**
* Cleanup after test.
*
- * @throws \CRM_Core_Exception
- * @throws \API_Exception
*/
public function tearDown(): void {
- $this->quickCleanup(['civicrm_batch']);
+ $this->quickCleanup(['civicrm_batch', 'civicrm_file', 'civicrm_entity_file']);
parent::tearDown();
}
*
* @throws \CRM_Core_Exception
*/
- public function testGetBatchFinancialItems() {
+ public function testGetBatchFinancialItems(): void {
// create two contributions: one check and one credit card
/**
* Test testExportFinancialBatch.
+ *
+ * @throws \CRM_Core_Exception
*/
- public function testExportFinancialBatch() {
+ public function testExportFinancialBatch(): void {
$this->createLoggedInUser();
$batchParams = ['title' => 'Test Batch'];
$batchParams['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Batch_BAO_Batch', 'status_id', 'Exported');
if ($this->callAPISuccessGetCount('membership', ['id' => $this->_membershipTypeID])) {
$this->membershipTypeDelete(['id' => $this->_membershipTypeID]);
}
- if ($this->callAPISuccessGetCount('MembershipStatus', ['id' => $this->_membershipStatusID])) {
- $this->membershipStatusDelete($this->_membershipStatusID);
- }
$this->contactDelete($this->_contactID);
$this->contactDelete($this->_contactID2);
$this->contactDelete($this->_orgContactID);
+ parent::tearDown();
}
/**
/**
* Clean up DB.
- *
- * @throws \CRM_Core_Exception|\API_Exception
*/
public function tearDown(): void {
$this->quickCleanUpFinancialEntities();
/**
* Test that correct contribution status is fetched for both live and test contributions.
*/
- public function testLiveAndTestContributionStatus() {
+ public function testLiveAndTestContributionStatus(): void {
$paymentProcessorID = $this->paymentProcessorCreate(['payment_processor_type_id' => 'Dummy']);
$form = $this->getThankYouFormWithContribution($paymentProcessorID, FALSE, FALSE);
/**
* Clean up after test.
- *
- * @throws \Exception
*/
public function tearDown(): void {
- $this->quickCleanup([], TRUE);
+ $this->quickCleanup(['civicrm_file', 'civicrm_entity_file'], TRUE);
parent::tearDown();
}
/**
* Test creating a custom field.
*/
- public function testCreateCustomField() {
+ public function testCreateCustomField(): void {
$customGroup = $this->createCustomField();
$customFieldID = $this->assertDBNotNull('CRM_Core_DAO_CustomField', $customGroup['id'], 'id', 'custom_group_id',
'Database check for created CustomField.'
/**
* Check that outputting the display value for a file field with No description doesn't generate error
*/
- public function testFileDisplayValueNoDescription() {
+ public function testFileDisplayValueNoDescription(): void {
$customGroup = $this->customGroupCreate([
'extends' => 'Individual',
'title' => 'Test Contact File Custom Group',
/**
* Create default domain contacts for the two domains added during test class.
* database population.
- *
- * @throws \API_Exception
*/
public function createDomainContacts(): void {
- $this->organizationCreate(['api.Email.create' => ['email' => 'fixme.domainemail@example.org']]);
- $this->organizationCreate([
- 'organization_name' => 'Second Domain',
- 'api.Email.create' => ['email' => 'domainemail2@example.org'],
- 'api.Address.create' => [
- 'street_address' => '15 Main St',
- 'location_type_id' => 1,
- 'city' => 'Collinsville',
- 'country_id' => 1228,
- 'state_province_id' => 1003,
- 'postal_code' => 6022,
- ],
- ]);
- OptionValue::replace(FALSE)->addWhere(
- 'option_group_id:name', '=', 'from_email_address'
- )->setDefaults([
- 'is_default' => 1,
- 'name' => '"FIXME" <info@EXAMPLE.ORG>',
- 'label' => '"FIXME" <info@EXAMPLE.ORG>',
- ])->setRecords([['domain_id' => 1], ['domain_id' => 2]])->execute();
+ try {
+ $this->organizationCreate(['api.Email.create' => ['email' => 'fixme.domainemail@example.org']]);
+ $this->organizationCreate([
+ 'organization_name' => 'Second Domain',
+ 'api.Email.create' => ['email' => 'domainemail2@example.org'],
+ 'api.Address.create' => [
+ 'street_address' => '15 Main St',
+ 'location_type_id' => 1,
+ 'city' => 'Collinsville',
+ 'country_id' => 1228,
+ 'state_province_id' => 1003,
+ 'postal_code' => 6022,
+ ],
+ ]);
+ OptionValue::replace(FALSE)->addWhere(
+ 'option_group_id:name', '=', 'from_email_address'
+ )->setDefaults([
+ 'is_default' => 1,
+ 'name' => '"FIXME" <info@EXAMPLE.ORG>',
+ 'label' => '"FIXME" <info@EXAMPLE.ORG>',
+ ])->setRecords([['domain_id' => 1], ['domain_id' => 2]])->execute();
+ }
+ catch (API_Exception $e) {
+ $this->fail('failed to re-instate domain contacts ' . $e->getMessage());
+ }
}
/**
* Common teardown functions for all unit tests.
- *
- * @throws \API_Exception
*/
protected function tearDown(): void {
$this->_apiversion = 3;