From e6f23b9857a1bbff6062ccc0884b9c370a04daac Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 28 Dec 2023 17:47:11 +0100 Subject: tests: Specify db type as string in env vars. --- tests/unit/UnitTestCase.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/unit/UnitTestCase.php b/tests/unit/UnitTestCase.php index 6c787ae06..4e3cea1ec 100644 --- a/tests/unit/UnitTestCase.php +++ b/tests/unit/UnitTestCase.php @@ -55,7 +55,7 @@ class UnitTestCase extends TestCase { getenv('HZ_TEST_DB_USER') ?: 'test_user', getenv('HZ_TEST_DB_PASS') ?: 'hubzilla', getenv('HZ_TEST_DB_DATABASE') ?: 'hubzilla_test_db', - getenv('HZ_TEST_DB_TYPE') ?: 1, + Self::dbtype(getenv('HZ_TEST_DB_TYPE')), getenv('HZ_TEST_DB_CHARSET') ?: 'UTF8', false); @@ -94,6 +94,14 @@ class UnitTestCase extends TestCase { } } + private static function dbtype(string $type): int { + if (trim(strtolower($type)) === 'postgres') { + return DBTYPE_POSTGRES; + } else { + return DBTYPE_MYSQL; + } + } + private function loadFixtures() : void { $files = glob(__DIR__ . '/includes/dba/_files/*.yml'); if ($files === false || empty($files)) { -- cgit v1.2.3