added unit tests

This commit is contained in:
2026-06-04 21:40:59 +02:00
parent d80a8de559
commit 48a619ee4b
64 changed files with 3807 additions and 33 deletions

View File

@ -20,8 +20,10 @@ $route = strtolower($route);
$method = $_SERVER['REQUEST_METHOD'];
qdb_api_log_begin($method, $route !== '' ? $route : '(root)');
register_shutdown_function('qdb_api_log_finish');
if (!defined('QDB_TESTING')) {
qdb_api_log_begin($method, $route !== '' ? $route : '(root)');
register_shutdown_function('qdb_api_log_finish');
}
// CORS
header('Access-Control-Allow-Origin: *');
@ -73,6 +75,13 @@ try {
require $handlerFile;
} catch (Throwable $e) {
if (defined('QDB_TESTING') && (
$e instanceof \Tests\Support\JsonSuccessResponse
|| $e instanceof \Tests\Support\JsonErrorResponse
|| $e instanceof \Tests\Support\RawHttpResponse
)) {
throw $e;
}
require_once __DIR__ . '/../lib/errors.php';
qdb_emit_api_error($e, "API $method $route");
}