dbxapp
4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
dbxapp.de
Portal
Start
Anwender
Entwickler
KI-Bereiche
Loading...
Searching...
No Matches
dbxContentMediaCache_contract_test.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types=1);
3
4
$root
= dirname(__DIR__, 3);
5
6
$responseFile
=
$root
.
'/dbx/modules/dbxContent/include/dbxContentMediaResponse.class.php'
;
7
$fallbackFile
=
$root
.
'/dbx/modules/dbxContent/dbxContent.class.php'
;
8
$response
= file_get_contents(
$responseFile
);
9
$fallback
= file_get_contents(
$fallbackFile
);
10
11
if
(!is_string(
$response
) || !is_string(
$fallback
)) {
12
throw
new
RuntimeException(
'Die dbxContent-Medienklassen konnten nicht gelesen werden.'
);
13
}
14
15
foreach
(array(
16
"header('ETag: ' . \$etag)"
,
17
"header('Last-Modified: ' . \$lastModified)"
,
18
"header('Cache-Control: private, no-cache')"
,
19
'HTTP_IF_NONE_MATCH'
,
20
'HTTP_IF_MODIFIED_SINCE'
,
21
) as $needle) {
22
if
(!str_contains(
$response
, $needle)) {
23
throw
new
RuntimeException(
'Der Medien-Cache-Vertrag fehlt: '
. $needle);
24
}
25
}
26
27
if
(str_contains(
$response
,
'max-age=3600'
)
28
|| str_contains(
$fallback
,
'max-age=31536000, immutable'
)
29
|| substr_count(
$fallback
,
"header('Cache-Control: private, no-cache')"
) < 2) {
30
throw
new
RuntimeException(
'Aktualisierte Medien dürfen nicht unter unveränderter ID veralten.'
);
31
}
32
33
echo
"OK dbxContent media responses revalidate changed files with ETag and Last-Modified\n"
;
$root
$root
Definition
db_access_boundary_test.php:3
$fallback
$fallback
Definition
dbxContentMediaCache_contract_test.php:9
$responseFile
$responseFile
Definition
dbxContentMediaCache_contract_test.php:6
$fallbackFile
$fallbackFile
Definition
dbxContentMediaCache_contract_test.php:7
$response
$response
Definition
dbxContentMediaCache_contract_test.php:8
dbx
include
tests
dbxContentMediaCache_contract_test.php
Generated by
1.17.0