-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_test.php
More file actions
36 lines (31 loc) · 822 Bytes
/
debug_test.php
File metadata and controls
36 lines (31 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REQUEST_URI'] = '/api/register';
$_SERVER['CONTENT_TYPE'] = 'application/json';
$_SERVER['HTTP_ACCEPT'] = 'application/json';
// Set JSON input
$input = json_encode([
'name' => 'Test User',
'email' => 'test@example.com',
'password' => 'password123',
'password_confirmation' => 'password123',
]);
// Mock stdin
$fp = fopen('php://memory', 'r+');
fwrite($fp, $input);
rewind($fp);
// Set the input stream
$GLOBALS['_SERVER']['CONTENT_LENGTH'] = strlen($input);
if (!isset($_SERVER['QUERY_STRING'])) {
$_SERVER['QUERY_STRING'] = '';
}
try {
ob_start();
include 'public/index.php';
$output = ob_get_clean();
echo $output;
} catch (\Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
echo $e->getTraceAsString();
}
?>