From: Tim Otten Date: Thu, 26 Jan 2023 09:03:05 +0000 (-0800) Subject: (NFC) Speed up more random tests, part 4 (58s=>29s) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7c50026999c16eeb2e7f170d33ea07c8c5e3f3aa;p=civicrm-core.git (NFC) Speed up more random tests, part 4 (58s=>29s) --- diff --git a/tests/phpunit/CRM/Utils/SQL/DeleteTest.php b/tests/phpunit/CRM/Utils/SQL/DeleteTest.php index 6eda504d61..a9a832232f 100644 --- a/tests/phpunit/CRM/Utils/SQL/DeleteTest.php +++ b/tests/phpunit/CRM/Utils/SQL/DeleteTest.php @@ -6,6 +6,11 @@ */ class CRM_Utils_SQL_DeleteTest extends CiviUnitTestCase { + public function setUp(): void { + $this->useTransaction(); + parent::setUp(); + } + public function testGetDefault() { $del = CRM_Utils_SQL_Delete::from('foo'); $this->assertLike('DELETE FROM foo', $del->toSQL()); diff --git a/tests/phpunit/CRM/Utils/SQL/InsertTest.php b/tests/phpunit/CRM/Utils/SQL/InsertTest.php index 2750876d08..0bd377ddbe 100644 --- a/tests/phpunit/CRM/Utils/SQL/InsertTest.php +++ b/tests/phpunit/CRM/Utils/SQL/InsertTest.php @@ -6,6 +6,11 @@ */ class CRM_Utils_SQL_InsertTest extends CiviUnitTestCase { + public function setUp(): void { + $this->useTransaction(); + parent::setUp(); + } + public function testRow_twice() { $insert = CRM_Utils_SQL_Insert::into('foo') ->row(['first' => '1', 'second' => '2']) diff --git a/tests/phpunit/CRM/Utils/SQL/SelectTest.php b/tests/phpunit/CRM/Utils/SQL/SelectTest.php index 74270a9468..c36641cdc8 100644 --- a/tests/phpunit/CRM/Utils/SQL/SelectTest.php +++ b/tests/phpunit/CRM/Utils/SQL/SelectTest.php @@ -6,6 +6,11 @@ */ class CRM_Utils_SQL_SelectTest extends CiviUnitTestCase { + public function setUp(): void { + $this->useTransaction(); + parent::setUp(); + } + public function testGetDefault() { $select = CRM_Utils_SQL_Select::from('foo bar'); $this->assertLike('SELECT * FROM foo bar', $select->toSQL()); diff --git a/tests/phpunit/CRM/Utils/SQLTest.php b/tests/phpunit/CRM/Utils/SQLTest.php index cc5e3679b2..5114f6014b 100644 --- a/tests/phpunit/CRM/Utils/SQLTest.php +++ b/tests/phpunit/CRM/Utils/SQLTest.php @@ -6,6 +6,11 @@ */ class CRM_Utils_SQLTest extends CiviUnitTestCase { + public function setUp(): void { + $this->useTransaction(); + parent::setUp(); + } + public function testInterpolate() { // This function is a thin wrapper for `CRM_Utils_SQL_BaseParamQuery::interpolate()`, which already has // lots of coverage in other test classes. This test just checks the basic wiring. diff --git a/tests/phpunit/CRM/Utils/SignerTest.php b/tests/phpunit/CRM/Utils/SignerTest.php index 5280a6c0a7..f30dcbfc62 100644 --- a/tests/phpunit/CRM/Utils/SignerTest.php +++ b/tests/phpunit/CRM/Utils/SignerTest.php @@ -15,6 +15,11 @@ */ class CRM_Utils_SignerTest extends CiviUnitTestCase { + public function setUp(): void { + $this->useTransaction(); + parent::setUp(); + } + public function testSignValidate() { $cases = []; $cases[] = [ diff --git a/tests/phpunit/CRM/Utils/SystemTest.php b/tests/phpunit/CRM/Utils/SystemTest.php index 197e42621f..edc7c0ed23 100644 --- a/tests/phpunit/CRM/Utils/SystemTest.php +++ b/tests/phpunit/CRM/Utils/SystemTest.php @@ -7,6 +7,11 @@ */ class CRM_Utils_SystemTest extends CiviUnitTestCase { + public function setUp(): void { + $this->useTransaction(); + parent::setUp(); + } + public function testUrlQueryString() { $config = CRM_Core_Config::singleton(); $this->assertTrue($config->userSystem instanceof CRM_Utils_System_UnitTests); diff --git a/tests/phpunit/CRM/Utils/TimeTest.php b/tests/phpunit/CRM/Utils/TimeTest.php index d2d7d0835f..1db72865cf 100644 --- a/tests/phpunit/CRM/Utils/TimeTest.php +++ b/tests/phpunit/CRM/Utils/TimeTest.php @@ -6,6 +6,11 @@ */ class CRM_Utils_TimeTest extends CiviUnitTestCase { + public function setUp(): void { + $this->useTransaction(); + parent::setUp(); + } + /** * Equal cases. * diff --git a/tests/phpunit/CRM/Utils/TokenTest.php b/tests/phpunit/CRM/Utils/TokenTest.php index 9b620d7c6b..ebd5d25511 100644 --- a/tests/phpunit/CRM/Utils/TokenTest.php +++ b/tests/phpunit/CRM/Utils/TokenTest.php @@ -8,6 +8,11 @@ use Civi\Token\TokenProcessor; */ class CRM_Utils_TokenTest extends CiviUnitTestCase { + public function setUp(): void { + $this->useTransaction(); + parent::setUp(); + } + /** * Test for replaceGreetingTokens. * diff --git a/tests/phpunit/CRM/Utils/ZipTest.php b/tests/phpunit/CRM/Utils/ZipTest.php index e0cc7fe211..28632948fb 100644 --- a/tests/phpunit/CRM/Utils/ZipTest.php +++ b/tests/phpunit/CRM/Utils/ZipTest.php @@ -22,6 +22,7 @@ class CRM_Utils_ZipTest extends CiviUnitTestCase { private $file = FALSE; public function setUp(): void { + $this->useTransaction(); parent::setUp(); $this->file = FALSE; } diff --git a/tests/phpunit/CRM/Utils/versionCheckTest.php b/tests/phpunit/CRM/Utils/versionCheckTest.php index dba85f9cc4..f1a2c449c2 100644 --- a/tests/phpunit/CRM/Utils/versionCheckTest.php +++ b/tests/phpunit/CRM/Utils/versionCheckTest.php @@ -8,6 +8,11 @@ use Civi\Test\Invasive; */ class CRM_Utils_versionCheckTest extends CiviUnitTestCase { + public function setUp(): void { + $this->useTransaction(); + parent::setUp(); + } + /** * @var array */