Skip to content

Commit

Permalink
[test] Call parent tearDown more consistently
Browse files Browse the repository at this point in the history
Primarliy consistentcy - also supports checking nullArray is cleared per

civicrm#14550
  • Loading branch information
eileenmcnaughton committed Jun 15, 2019
1 parent 5dbbdfb commit ae5e4fd
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 6 deletions.
1 change: 1 addition & 0 deletions tests/phpunit/api/v3/AddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function tearDown() {
$this->locationTypeDelete($this->_locationType->id);
$this->contactDelete($this->_contactID);
$this->quickCleanup(array('civicrm_address', 'civicrm_relationship'));
parent::tearDown();
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/api/v3/CRM11793Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function setUp() {
}

public function tearDown() {
parent::tearDown();
}

/**
Expand Down
5 changes: 5 additions & 0 deletions tests/phpunit/api/v3/ContributionPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function tearDown() {
$this->callAPISuccess('contact', 'delete', array('id' => $id));
}
$this->quickCleanUpFinancialEntities();
parent::tearDown();
}

/**
Expand Down Expand Up @@ -1641,6 +1642,9 @@ public static function setUpBeforeClass() {
// put stuff here that should happen before all tests in this unit
}

/**
* @throws \Exception
*/
public static function tearDownAfterClass() {
$tablesToTruncate = array(
'civicrm_contact',
Expand All @@ -1650,6 +1654,7 @@ public static function tearDownAfterClass() {
);
$unitTest = new CiviUnitTestCase();
$unitTest->quickCleanup($tablesToTruncate);
parent::tearDown();
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/api/v3/FinancialTypeACLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,14 @@ public function setUp() {

/**
* Clean up after each test.
*
* @throws \Exception
*/
public function tearDown() {
$this->quickCleanUpFinancialEntities();
$this->quickCleanup(array('civicrm_uf_match'));
$this->disableFinancialACLs();
parent::tearDown();
}

/**
Expand Down
8 changes: 7 additions & 1 deletion tests/phpunit/api/v3/GrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,19 @@ public function setUp() {
);
}

/**
* Cleanup after test.
*
* @throws \Exception
*/
public function tearDown() {
foreach ($this->ids as $entity => $entities) {
foreach ($entities as $id) {
$this->callAPISuccess($entity, 'delete', array('id' => $id));
}
}
$this->quickCleanup(array('civicrm_grant'));
$this->quickCleanup(['civicrm_grant']);
parent::tearDown();
}

public function testCreateGrant() {
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/api/v3/GroupNestingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ protected function tearDown() {
'civicrm_uf_match',
]
);
parent::tearDown();
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/api/v3/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ public function setUp() {

/**
* Clean up after test.
*
* @throws \Exception
*/
public function tearDown() {
CRM_Utils_Hook::singleton()->reset();
$config = CRM_Core_Config::singleton();
unset($config->userPermissionClass->permissions);
$this->quickCleanup(['civicrm_group', 'civicrm_group_contact']);
parent::tearDown();
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/api/v3/JobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function tearDown() {
$this->membershipTypeDelete(array('id' => $this->membershipTypeID));
$this->cleanUpSetUpIDs();
$this->quickCleanup(['civicrm_contact', 'civicrm_address', 'civicrm_email', 'civicrm_website', 'civicrm_phone'], TRUE);
parent::tearDown();
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/phpunit/api/v3/MembershipStatusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ public function setUp() {

public function tearDown() {
$this->membershipStatusDelete($this->_membershipStatusID);
$this->membershipTypeDelete(array('id' => $this->_membershipTypeID));
$this->membershipTypeDelete(['id' => $this->_membershipTypeID]);
$this->contactDelete($this->_contactID);
parent::tearDown();
}

///////////////// civicrm_membership_status_get methods
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/api/v3/MembershipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function tearDown() {
$this->membershipTypeDelete(array('id' => $this->_membershipTypeID2));
$this->membershipTypeDelete(array('id' => $this->_membershipTypeID));
$this->contactDelete($this->_contactID);

parent::tearDown();
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/api/v3/PaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ public function setUp() {

/**
* Clean up after each test.
*
* @throws \Exception
*/
public function tearDown() {
$this->quickCleanUpFinancialEntities();
$this->quickCleanup(['civicrm_uf_match']);
unset(CRM_Core_Config::singleton()->userPermissionClass->permissions);
parent::tearDown();
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/api/v3/PledgePaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function tearDown() {
);

$this->quickCleanup($tablesToTruncate);
parent::tearDown();
}

public function testGetPledgePayment() {
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/api/v3/PriceFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function tearDown() {
));

$this->assertAPISuccess($delete);
parent::tearDown();
}

public function testCreatePriceField() {
Expand Down
3 changes: 0 additions & 3 deletions tests/phpunit/api/v3/PriceSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ public function setUp() {
);
}

public function tearDown() {
}

/**
* Test create price set.
*/
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/api/v3/RelationshipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function tearDown() {
$this->contactDelete($this->_cId_b2);
$this->quickCleanup(array('civicrm_relationship'), TRUE);
$this->relationshipTypeDelete($this->_relTypeID);
parent::tearDown();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions tests/phpunit/api/v3/TaxContributionPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,12 @@ public function setUp() {
$this->assertAPISuccess($result);
}

/**
* Cleanup after function.
*/
public function tearDown() {
$this->quickCleanUpFinancialEntities();
parent::tearDown();
}

public function setUpContributionPage() {
Expand Down

0 comments on commit ae5e4fd

Please sign in to comment.