Skip to content
Snippets Groups Projects
Unverified Commit b2b7fd98 authored by totten's avatar totten Committed by GitHub
Browse files

Merge pull request #25439 from totten/master-test-tx

(NFC) Speed up random tests by 55-60%
parents f4672010 7c500269
Branches
Tags
No related merge requests found
Showing
with 89 additions and 0 deletions
......@@ -12,6 +12,7 @@ class CRM_Utils_API_MatchOptionTest extends CiviUnitTestCase {
public $noise;
public function setUp(): void {
$this->useTransaction();
parent::setUp();
$this->assertDBQuery(0, "SELECT count(*) FROM civicrm_contact WHERE first_name='Jeffrey' and last_name='Lebowski'");
......
......@@ -12,6 +12,7 @@
class CRM_Utils_API_ReloadOptionTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
CRM_Utils_Hook_UnitTests::singleton()->setHook('civicrm_post', [$this, 'onPost']);
}
......
......@@ -6,6 +6,14 @@
*/
class CRM_Utils_ArrayTest extends CiviUnitTestCase {
/**
* Set up for tests.
*/
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
public function testAsColumns() {
$rowsNum = [
['a' => 10, 'b' => 11],
......
......@@ -8,6 +8,11 @@
*/
class CRM_Utils_Check_Component_EnvTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* File check test should fail if reached maximum timeout.
* @throws \GuzzleHttp\Exception\GuzzleException
......
......@@ -8,6 +8,11 @@
*/
class CRM_Utils_Check_Component_OptionGroupsTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
public function testCheckOptionGroupValues() {
$optionGroup = $this->callAPISuccess('OptionGroup', 'create', [
'name' => 'testGroup',
......
......@@ -6,6 +6,11 @@
*/
class CRM_Utils_ColorTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* @dataProvider contrastExamples
*/
......
......@@ -26,6 +26,14 @@
*/
class CRM_Utils_DateTest extends CiviUnitTestCase {
/**
* Set up for tests.
*/
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* Used by testGetFromTo
*/
......
......@@ -6,6 +6,11 @@
*/
class CRM_Utils_GlobalStackTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* Temporarily override global variables and ensure that the variable data.
* is set as expected (before/during/after the override).
......
......@@ -15,6 +15,11 @@
*/
class CRM_Utils_HTMLTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* @return array
*/
......
......@@ -13,6 +13,7 @@ class CRM_Utils_HookTest extends CiviUnitTestCase {
public $log;
public function setUp(): void {
$this->useTransaction();
parent::setUp();
$this->fakeModules = [
'hooktesta',
......
......@@ -6,6 +6,11 @@
*/
class CRM_Utils_HtmlToTextTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* @return array
*/
......
......@@ -25,6 +25,7 @@ class CRM_Utils_HttpClientTest extends CiviUnitTestCase {
protected $client;
public function setUp(): void {
$this->useTransaction();
parent::setUp();
$this->tmpFile = $this->createTempDir() . '/example.txt';
......
......@@ -15,6 +15,11 @@
*/
class CRM_Utils_ICalendarTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* @return array
*/
......
......@@ -15,6 +15,14 @@
*/
class CRM_Utils_JSTest extends CiviUnitTestCase {
/**
* Set up for tests.
*/
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* @return array
*/
......
......@@ -6,6 +6,11 @@
*/
class CRM_Utils_LazyArrayTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
public function testAssoc() {
$l = $this->createFruitBasket();
$this->assertFalse($l->isLoaded());
......
......@@ -6,6 +6,11 @@
*/
class CRM_Utils_Mail_FilteredPearMailerTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
public function testFilter() {
$mock = new class() extends \Mail {
public $buf = [];
......
......@@ -32,6 +32,7 @@ class CRM_Utils_Mail_IncomingTest extends CiviUnitTestCase {
protected $name;
public function setUp(): void {
$this->useTransaction();
parent::setUp();
$rand = rand(0, 1000);
......
......@@ -6,6 +6,11 @@
*/
class CRM_Utils_MailTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* Test case for add( )
* test with empty params.
......
......@@ -7,6 +7,11 @@
*/
class CRM_Utils_MoneyTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* @dataProvider subtractCurrenciesDataProvider
* @param string $leftOp
......
......@@ -6,6 +6,11 @@
*/
class CRM_Utils_NumberTest extends CiviUnitTestCase {
public function setUp(): void {
$this->useTransaction();
parent::setUp();
}
/**
* @return array
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment