aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2023-12-28 17:47:11 +0100
committerHarald Eilertsen <haraldei@anduin.net>2023-12-28 17:47:11 +0100
commite6f23b9857a1bbff6062ccc0884b9c370a04daac (patch)
tree1575528bff5e444229ba7882db630a5a8426f111
parent431b5c4aa1fd6e7a6af744af337b1512ec4bda87 (diff)
downloadvolse-hubzilla-e6f23b9857a1bbff6062ccc0884b9c370a04daac.tar.gz
volse-hubzilla-e6f23b9857a1bbff6062ccc0884b9c370a04daac.tar.bz2
volse-hubzilla-e6f23b9857a1bbff6062ccc0884b9c370a04daac.zip
tests: Specify db type as string in env vars.
-rw-r--r--tests/unit/UnitTestCase.php10
1 files changed, 9 insertions, 1 deletions
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)) {