Added tests

This commit is contained in:
Gregory Magarshak
2026-07-21 08:39:17 -04:00
parent 5983f11b91
commit a99b9fe8e6
12 changed files with 577 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
secret
+1
View File
@@ -0,0 +1 @@
secret
+1
View File
@@ -0,0 +1 @@
{"a":1}
+3
View File
@@ -0,0 +1,3 @@
<?php
echo "about to exit";
exit(1);
+3
View File
@@ -0,0 +1,3 @@
<?php
// Trigger a fatal error
call_undefined_function_that_does_not_exist();
+5
View File
@@ -0,0 +1,5 @@
<?php
Q::header('X-Custom-Header: hello');
Q::header('Cache-Control: public, max-age=300');
Q::header('HTTP/1.1 201 Created', true, 201);
echo 'created';
+21
View File
@@ -0,0 +1,21 @@
<?php
Q::header('Content-Type: application/json');
echo json_encode([
'method' => $_SERVER['REQUEST_METHOD'],
'uri' => $_SERVER['REQUEST_URI'],
'query' => $_GET,
'post' => $_POST,
'cookies' => $_COOKIE,
'files' => array_map(function($f) { return ['name'=>$f['name'],'size'=>$f['size']]; }, $_FILES),
'php_self' => $_SERVER['PHP_SELF'],
'doc_root' => $_SERVER['DOCUMENT_ROOT'],
'server_sw' => $_SERVER['SERVER_SOFTWARE'],
'gateway' => $_SERVER['GATEWAY_INTERFACE'],
'remote' => $_SERVER['REMOTE_ADDR'],
'scheme' => $_SERVER['REQUEST_SCHEME'],
'auth_user' => $_SERVER['PHP_AUTH_USER'] ?? null,
'q_class' => class_exists('Q'),
'q_request' => class_exists('Q_Request'),
'q_config' => class_exists('Q_Config'),
'raw_input' => Q_Request::input(),
]);
+1
View File
@@ -0,0 +1 @@
<!DOCTYPE html><html><body><h1>Test Page</h1></body></html>
+3
View File
@@ -0,0 +1,3 @@
<?php
sleep(2);
echo json_encode(['slept' => 2]);
+1
View File
@@ -0,0 +1 @@
body{}
+11
View File
@@ -0,0 +1,11 @@
<?php
Q::header('Content-Type: application/json');
$result = ['post' => $_POST, 'files' => []];
foreach ($_FILES as $k => $f) {
$result['files'][$k] = [
'name' => $f['name'], 'size' => $f['size'],
'type' => $f['type'], 'error' => $f['error'],
'content' => file_get_contents($f['tmp_name']),
];
}
echo json_encode($result);