26 return
$GLOBALS[
'dbxMissingResourcesTestApi'];
29require_once dirname(__DIR__) .
'/dbxWebApp.class.php';
34$fail =
static function (
string $message,
int $code): void {
35 fwrite(STDERR,
"FAIL: $message\n");
40 'js',
'mjs',
'css',
'map',
'json',
'wasm',
41 'png',
'jpg',
'svg',
'webp',
'avif',
'ico',
42 'woff',
'woff2',
'ttf',
'pdf',
'zip',
'mp3',
'mp4',
45 if (
$web->get_is_resorce($extension) !== 1) {
46 $fail(
"Ressourcenerweiterung .$extension wird nicht erkannt.", 1);
50foreach (array(
'',
'html',
'htm',
'php',
'dbx') as $extension) {
51 if (
$web->get_is_resorce($extension) !== 0) {
52 $fail(
"Seiten-/Programmerweiterung .$extension wird faelschlich als Ressource erkannt.", 2);
58$_SERVER[
'HTTP_REFERER'] =
'https://www.dbxapp.de/home?preview=1';
59$api->system[
'dbx_permalink'] =
'assets/__dbx-missing-resource-test__.svg';
60http_response_code(200);
65 ||
$api->logged !== array(
'assets/__dbx-missing-resource-test__.svg')) {
66 $fail(
'Fehlendes SVG wird nicht leer mit HTTP 404 protokolliert.', 3);
70$api->system[
'dbx_permalink'] =
'api/openapi.json';
71http_response_code(200);
72if (!
$web->check_missing() || http_response_code() !== 404 || count(
$api->logged) !== 1) {
73 $fail(
'Direkte Bot-/Scanner-Anfrage ohne interne Herkunft wird protokolliert.', 4);
76$_SERVER[
'HTTP_REFERER'] =
'https://scanner.example/probe';
77$api->system[
'dbx_permalink'] =
'api/swagger.json';
78http_response_code(200);
79if (!
$web->check_missing() || http_response_code() !== 404 || count(
$api->logged) !== 1) {
80 $fail(
'Externe Ressourcenanfrage wird als interner Seitenfehler protokolliert.', 5);
83$api->system[
'dbx_permalink'] =
'assets/__dbx-missing-resource-test__%2Ewoff2';
84$_SERVER[
'HTTP_REFERER'] =
'https://dbxapp.de/home';
85http_response_code(200);
87if (!
$handled || http_response_code() !== 404 || count(
$api->logged) !== 2) {
88 $fail(
'URL-kodierte Ressourcenerweiterung wird nicht erkannt.', 6);
92$api->system[
'dbx_permalink'] =
'assets/__dbx-missing-resource-test__.js';
93http_response_code(200);
96$body = ob_get_clean();
97if (!
$handled || http_response_code() !== 404 ||
$body !==
'' || count(
$api->logged) !== 3) {
98 $fail(
'HEAD fuer eine fehlende Ressource ist nicht konsistent.', 7);
104 $fail(
'Der Standardpfad apple-touch-icon.png wird nicht auf das vorhandene Favicon aufgeloest.', 8);
107$defaultTemplate = (string)file_get_contents(dirname(__DIR__, 2) .
'/design/dbxapp/htm/default.htm');
109 $fail(
'Das dbxapp-Design deklariert kein Apple-Touch-Icon.', 9);
113foreach (array(
'shop/produkt',
'hilfe/seite.html',
'sitemap.xml',
'robots.txt') as $route) {
114 $api->system[
'dbx_permalink'] = $route;
115 http_response_code(200);
116 if (
$web->check_missing() || http_response_code() !== 200) {
117 $fail(
"Normale/dynamische Route $route wird faelschlich als Ressource behandelt.", 10);
120if (count(
$api->logged) !== 3) {
121 $fail(
'Normale Seiten oder Systemrouten wurden protokolliert.', 11);