(NFC) Speed up more random tests, part 4 (58s=>29s)
authorTim Otten <totten@civicrm.org>
Thu, 26 Jan 2023 09:03:05 +0000 (01:03 -0800)
committerTim Otten <totten@civicrm.org>
Thu, 26 Jan 2023 09:06:21 +0000 (01:06 -0800)
tests/phpunit/CRM/Utils/SQL/DeleteTest.php
tests/phpunit/CRM/Utils/SQL/InsertTest.php
tests/phpunit/CRM/Utils/SQL/SelectTest.php
tests/phpunit/CRM/Utils/SQLTest.php
tests/phpunit/CRM/Utils/SignerTest.php
tests/phpunit/CRM/Utils/SystemTest.php
tests/phpunit/CRM/Utils/TimeTest.php
tests/phpunit/CRM/Utils/TokenTest.php
tests/phpunit/CRM/Utils/ZipTest.php
tests/phpunit/CRM/Utils/versionCheckTest.php

index 6eda504d618623f59a2bd43be22eb62264d62b76..a9a832232fbd229d7a83fbe622e15af123065ded 100644 (file)
@@ -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());
index 2750876d08fe2210f7ade10cff3acb5f233cad7d..0bd377ddbee0a574a0218c3114556319a7813436 100644 (file)
@@ -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'])
index 74270a94684f927854c3fa1f0c258745ae72edad..c36641cdc80b6332967cb5c36e07b983459a62a7 100644 (file)
@@ -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());
index cc5e3679b2db0b5fed35f6db4cb4e8176ce514f8..5114f6014bd32f44bf82f81b35ddc442f3d052a5 100644 (file)
@@ -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.
index 5280a6c0a77744df397d43fda9fcef8e8f9535e0..f30dcbfc622132043eedf695b2fa342339a18ca5 100644 (file)
  */
 class CRM_Utils_SignerTest extends CiviUnitTestCase {
 
+  public function setUp(): void {
+    $this->useTransaction();
+    parent::setUp();
+  }
+
   public function testSignValidate() {
     $cases = [];
     $cases[] = [
index 197e42621f3a727b44976e9339d0561e405920ce..edc7c0ed2370693c8007900657fae6aaea09b066 100644 (file)
@@ -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);
index d2d7d0835fa831d361468e3d0494e0023ec37d31..1db72865cfab65777c3af3b14ac54765333f3557 100644 (file)
@@ -6,6 +6,11 @@
  */
 class CRM_Utils_TimeTest extends CiviUnitTestCase {
 
+  public function setUp(): void {
+    $this->useTransaction();
+    parent::setUp();
+  }
+
   /**
    * Equal cases.
    *
index 9b620d7c6b7882216e19fb0ccc13c7c93e1a4f49..ebd5d25511f8ce39941ff43c2d575be4834a0bdf 100644 (file)
@@ -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.
    *
index e0cc7fe2113a0b8f5266ad6df5a2d5d1f5639f62..28632948fb1ca405030356402259d4d6472a0118 100644 (file)
@@ -22,6 +22,7 @@ class CRM_Utils_ZipTest extends CiviUnitTestCase {
   private $file = FALSE;
 
   public function setUp(): void {
+    $this->useTransaction();
     parent::setUp();
     $this->file = FALSE;
   }
index dba85f9cc4345aea319079642a5f04476086e492..f1a2c449c2e6cbb59a0efb290b3c77ae84aed39b 100644 (file)
@@ -8,6 +8,11 @@ use Civi\Test\Invasive;
  */
 class CRM_Utils_versionCheckTest extends CiviUnitTestCase {
 
+  public function setUp(): void {
+    $this->useTransaction();
+    parent::setUp();
+  }
+
   /**
    * @var array
    */