added unit tests
This commit is contained in:
29
tests/bootstrap.php
Normal file
29
tests/bootstrap.php
Normal 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';
|
||||
Reference in New Issue
Block a user