From 168ff84b7ace7381d844fefa1e127e6603e29726 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 14 Dec 2022 23:13:02 -0800 Subject: [PATCH] CiviUnitTestCase - Move UF check In practice, this check is the first thing done by `setUpBeforeClass()`. Might as well move it there. Technically, this check is also called by way of `setUp()`, but it's redundant at that point. (Constants are constants...) --- tests/phpunit/CiviTest/CiviUnitTestCase.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 0660d25b77..eafb871002 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -262,10 +262,6 @@ class CiviUnitTestCase extends PHPUnit\Framework\TestCase { * TRUE if the populate logic runs; FALSE if it is skipped */ protected static function _populateDB($perClass = FALSE, &$object = NULL) { - if (CIVICRM_UF !== 'UnitTests') { - throw new \RuntimeException("_populateDB requires CIVICRM_UF=UnitTests"); - } - if ($perClass || $object == NULL) { $dbreset = TRUE; } @@ -287,6 +283,10 @@ class CiviUnitTestCase extends PHPUnit\Framework\TestCase { } public static function setUpBeforeClass(): void { + if (CIVICRM_UF !== 'UnitTests') { + throw new \RuntimeException("CiviUnitTestCase requires CIVICRM_UF=UnitTests"); + } + static::_populateDB(TRUE); // also set this global hack -- 2.25.1