dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxApi_head_response_test.php
Go to the documentation of this file.
1<?php
2
3require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
4require_once dirname(__DIR__) . '/dbxApi.php';
5
6$api = new dbxApi();
7$method = new ReflectionMethod(dbxApi::class, 'emit_http_response_body');
8$method->setAccessible(true);
9
10$_SERVER['REQUEST_METHOD'] = 'HEAD';
11ob_start();
12$method->invoke($api, '<html>HEAD darf keinen Body liefern</html>');
13$headBody = ob_get_clean();
14if ($headBody !== '') {
15 fwrite(STDERR, "FAIL: HEAD gibt bei einem Cache-MISS einen Response-Body aus.\n");
16 exit(1);
17}
18
19$_SERVER['REQUEST_METHOD'] = 'GET';
20ob_start();
21$method->invoke($api, '<html>GET-Body</html>');
22$getBody = ob_get_clean();
23if ($getBody !== '<html>GET-Body</html>') {
24 fwrite(STDERR, "FAIL: GET-Body wird nicht unveraendert ausgegeben.\n");
25 exit(2);
26}
27
28echo "OK dbxApi HEAD response\n";
29
Zentrale Laufzeit-API von dbXapp.
Definition dbxApi.php:39
$_SERVER['REQUEST_METHOD']
exit
Definition index.php:146