Skip to content

Commit

Permalink
[NFC] Add in voids to various setUpBeforeClass and tearDownAfterClass…
Browse files Browse the repository at this point in the history
… functions
  • Loading branch information
seamuslee001 committed May 20, 2021
1 parent 4f2c365 commit e26a40f
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 25 deletions.
2 changes: 1 addition & 1 deletion ext/afform/mock/tests/phpunit/api/v4/AfformRoutingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class api_v4_AfformRoutingTest extends \PHPUnit\Framework\TestCase implements \C

protected $formName = 'mockPage';

public static function setUpBeforeClass() {
public static function setUpBeforeClass(): void {
\Civi\Test::e2e()
->install(['org.civicrm.afform', 'org.civicrm.afform-mock'])
->apply();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ public function setUpHeadless() {
->apply();
}

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

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

/**
* Test running a searchDisplay with various filters.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Utils/QueryFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function createExampleTable() {
}
}

public static function tearDownAfterClass() {
public static function tearDownAfterClass(): void {
CRM_Core_DAO::executeQuery('DROP TABLE IF EXISTS civicrm_fts_example');
parent::tearDownAfterClass();
}
Expand Down
6 changes: 3 additions & 3 deletions tests/phpunit/Civi/Test/ExampleTransactionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function setUp(): void {
/**
* In the first test, we make make testDummy1. He exists.
*/
public function testDummy1() {
public function testDummy1(): void {
$this->assertTrue(is_numeric(self::$contactIds['testDummy1']) && self::$contactIds['testDummy1'] > 0);

// Still inside transaction. Data exists.
Expand All @@ -45,7 +45,7 @@ public function testDummy1() {
* We previously made testDummy1, but he's been lost (rolled-back).
* However, testDummy2 now exists.
*/
public function testDummy2() {
public function testDummy2(): void {
$this->assertTrue(is_numeric(self::$contactIds['testDummy1']) && self::$contactIds['testDummy1'] > 0);
$this->assertTrue(is_numeric(self::$contactIds['testDummy2']) && self::$contactIds['testDummy2'] > 0);

Expand All @@ -66,7 +66,7 @@ public function testDummy2() {
*
* @throws \Exception
*/
public static function tearDownAfterClass() {
public static function tearDownAfterClass(): void {
if (!is_numeric(self::$contactIds['testDummy1'])) {
throw new \Exception("Uh oh! The static \$contactIds does not include testDummy1! Did the test fail to execute?");
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CiviTest/CiviEndToEndTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class CiviEndToEndTestCase extends PHPUnit\Framework\TestCase implements \Civi\Test\EndToEndInterface {

public static function setUpBeforeClass() {
public static function setUpBeforeClass(): void {
CRM_Core_Config::singleton(1, 1);
CRM_Utils_System::loadBootStrap(array(
'name' => $GLOBALS['_CV']['ADMIN_USER'],
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CiviTest/CiviUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ protected static function _populateDB($perClass = FALSE, &$object = NULL) {
return TRUE;
}

public static function setUpBeforeClass() {
public static function setUpBeforeClass(): void {
static::_populateDB(TRUE);

// also set this global hack
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/E2E/Cache/CacheTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class E2E_Cache_CacheTestCase extends \Cache\IntegrationTests\SimpleCac

const MAX_KEY = 255;

public static function setUpBeforeClass() {
public static function setUpBeforeClass(): void {
CRM_Core_Config::singleton(1, 1);
CRM_Utils_System::loadBootStrap(array(
'name' => $GLOBALS['_CV']['ADMIN_USER'],
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/api/v3/ContributionPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1731,10 +1731,6 @@ public function testSubmitMultiIntervalMembershipContributionPage() {
//$this->assertEquals(12, $contribution['values'][1]['api.ContributionRecur.getsingle']['frequency_interval']);
}

public static function setUpBeforeClass() {
// put stuff here that should happen before all tests in this unit
}

/**
* Create a payment processor instance.
*
Expand Down
6 changes: 1 addition & 5 deletions tests/phpunit/api/v3/PriceSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,7 @@ public function testGetFieldsPriceSet() {
$this->assertEquals(16, $result['values']['is_quick_config']['type']);
}

public static function setUpBeforeClass() {
// put stuff here that should happen before all tests in this unit
}

public static function tearDownAfterClass() {
public static function tearDownAfterClass(): void {
$tablesToTruncate = [
'civicrm_contact',
'civicrm_contribution',
Expand Down

0 comments on commit e26a40f

Please sign in to comment.