initial prototype based on nat-as-server
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
tom.hempel
2026-06-29 12:39:55 +02:00
commit f1caa9e681
148 changed files with 34905 additions and 0 deletions

29
tests/bootstrap.php Normal file
View File

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
define('QDB_TESTING', true);
define('QDB_TEST_UPLOADS', __DIR__ . '/runtime/uploads');
$runtimeRoot = dirname(QDB_TEST_UPLOADS);
if (!is_dir($runtimeRoot)) {
mkdir($runtimeRoot, 0755, true);
}
if (!is_dir(QDB_TEST_UPLOADS)) {
mkdir(QDB_TEST_UPLOADS, 0755, true);
}
putenv('QDB_API_LOG_DIR=' . QDB_TEST_UPLOADS . '/logs/api');
$_ENV['QDB_API_LOG_DIR'] = QDB_TEST_UPLOADS . '/logs/api';
$testMasterKey = base64_encode(str_repeat('T', 32));
require dirname(__DIR__) . '/vendor/autoload.php';
require_once dirname(__DIR__) . '/lib/response.php';
require_once dirname(__DIR__) . '/common.php';
// Always use the test key, even when .env defines QDB_MASTER_KEY (avoids decrypt/seed drift).
qdb_env_set('QDB_MASTER_KEY', $testMasterKey);
$GLOBALS['qdb_dotenv']['QDB_MASTER_KEY'] = $testMasterKey;
require_once dirname(__DIR__) . '/db_init.php';