Files
nat-as-server/tests/bootstrap.php
2026-06-04 21:40:59 +02:00

30 lines
885 B
PHP

<?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';