From: Seamus Lee Date: Thu, 20 May 2021 08:25:18 +0000 (+1000) Subject: [NFC] Add in voids to various setUpBeforeClass and tearDownAfterClass functions X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e26a40f69d43c150eb5b59f3372abf056e899130;p=civicrm-core.git [NFC] Add in voids to various setUpBeforeClass and tearDownAfterClass functions --- diff --git a/ext/afform/mock/tests/phpunit/api/v4/AfformRoutingTest.php b/ext/afform/mock/tests/phpunit/api/v4/AfformRoutingTest.php index 5d310b7c2f..00eb9ef401 100644 --- a/ext/afform/mock/tests/phpunit/api/v4/AfformRoutingTest.php +++ b/ext/afform/mock/tests/phpunit/api/v4/AfformRoutingTest.php @@ -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(); diff --git a/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunTest.php b/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunTest.php index c1c2c2e19f..5264f9e33c 100644 --- a/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunTest.php +++ b/ext/search_kit/tests/phpunit/api/v4/SearchDisplay/SearchRunTest.php @@ -22,14 +22,6 @@ class SearchRunTest extends \PHPUnit\Framework\TestCase implements HeadlessInter ->apply(); } - public function setUp() { - parent::setUp(); - } - - public function tearDown() { - parent::tearDown(); - } - /** * Test running a searchDisplay with various filters. */ diff --git a/tests/phpunit/CRM/Utils/QueryFormatterTest.php b/tests/phpunit/CRM/Utils/QueryFormatterTest.php index de557c933e..96efb14ac6 100644 --- a/tests/phpunit/CRM/Utils/QueryFormatterTest.php +++ b/tests/phpunit/CRM/Utils/QueryFormatterTest.php @@ -43,7 +43,7 @@ class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { } } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { CRM_Core_DAO::executeQuery('DROP TABLE IF EXISTS civicrm_fts_example'); parent::tearDownAfterClass(); } diff --git a/tests/phpunit/Civi/Test/ExampleTransactionalTest.php b/tests/phpunit/Civi/Test/ExampleTransactionalTest.php index b147434aea..ec3d503929 100644 --- a/tests/phpunit/Civi/Test/ExampleTransactionalTest.php +++ b/tests/phpunit/Civi/Test/ExampleTransactionalTest.php @@ -32,7 +32,7 @@ class ExampleTransactionalTest extends \PHPUnit\Framework\TestCase implements He /** * 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. @@ -45,7 +45,7 @@ class ExampleTransactionalTest extends \PHPUnit\Framework\TestCase implements He * 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); @@ -66,7 +66,7 @@ class ExampleTransactionalTest extends \PHPUnit\Framework\TestCase implements He * * @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?"); } diff --git a/tests/phpunit/CiviTest/CiviEndToEndTestCase.php b/tests/phpunit/CiviTest/CiviEndToEndTestCase.php index 93c33236c4..272670c071 100644 --- a/tests/phpunit/CiviTest/CiviEndToEndTestCase.php +++ b/tests/phpunit/CiviTest/CiviEndToEndTestCase.php @@ -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'], diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index de13fa74ab..9f2c06e3ee 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -316,7 +316,7 @@ class CiviUnitTestCase extends PHPUnit\Framework\TestCase { return TRUE; } - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { static::_populateDB(TRUE); // also set this global hack diff --git a/tests/phpunit/E2E/Cache/CacheTestCase.php b/tests/phpunit/E2E/Cache/CacheTestCase.php index c915f524ce..4420fb324f 100644 --- a/tests/phpunit/E2E/Cache/CacheTestCase.php +++ b/tests/phpunit/E2E/Cache/CacheTestCase.php @@ -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'], diff --git a/tests/phpunit/api/v3/ContributionPageTest.php b/tests/phpunit/api/v3/ContributionPageTest.php index 68a83aa856..f64673fe11 100644 --- a/tests/phpunit/api/v3/ContributionPageTest.php +++ b/tests/phpunit/api/v3/ContributionPageTest.php @@ -1731,10 +1731,6 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { //$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. * diff --git a/tests/phpunit/api/v3/PriceSetTest.php b/tests/phpunit/api/v3/PriceSetTest.php index 1fa81b255f..f9f0bc446b 100644 --- a/tests/phpunit/api/v3/PriceSetTest.php +++ b/tests/phpunit/api/v3/PriceSetTest.php @@ -129,11 +129,7 @@ class api_v3_PriceSetTest extends CiviUnitTestCase { $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',