phpunit URL Requests backend test file

This commit is contained in:
Clemens Schwaighofer
2024-11-01 14:43:10 +09:00
parent 4bc2ad8fa0
commit 6e7b9cd033

View File

@@ -0,0 +1,28 @@
<?php
/**
* AUTHOR: Clemens Schwaighofer
* CREATED: Ymd
* DESCRIPTION:
* DescriptionHere
*/
declare(strict_types=1);
$http_headers = array_filter($_SERVER, function ($value, $key) {
if (str_starts_with($key, 'HTTP_')) {
return true;
}
}, ARRAY_FILTER_USE_BOTH);
$file_get = file_get_contents('php://input') ?: '["code": 500, "content": {"Error" => "file_get_contents failed"}]';
header("Content-Type: application/json; charset=UTF-8");
print json_encode([
'HEADERS' => $http_headers,
"PARAMS" => $_GET,
"BODY" => json_decode($file_get, true),
]);
// __END__