6$assert =
static function(
bool $condition,
string $message) use (&
$failures):
void {
11$cmsPhp = (string)file_get_contents(
$base .
'/modules/dbxContent_admin/include/dbxContent_cms.class.php');
12$cmsCss = (string)file_get_contents(
$base .
'/design/dbxapp/css/c-cms.css');
15 str_contains(
$cmsJs,
'function reconcileMediaBrowserUsageWithEditor(root, rows)')
16 && str_contains(
$cmsJs,
'collectInlineMediaIdsFromEditor(root).forEach(id => add(id, "inline"));')
17 && str_contains(
$cmsJs,
'const rows = reconcileMediaBrowserUsageWithEditor(root,'),
18 'The media browser usage list is not reconciled with the current editor content.'
21 str_contains(
$cmsJs,
'function mediaUsageSlots(row)')
22 && str_contains(
$cmsJs,
'mediaUsageSlots(row).includes(slotFilter)')
23 && str_contains(
$cmsJs,
'page.slots'),
24 'The media browser still filters or labels usage by one arbitrary usage slot.'
27 !str_contains(
$cmsJs,
'.sort((a, b) => a - b)\n .join(",");'),
28 'The used-media signature still discards the actual editor order.'
31 str_contains(
$cmsPhp,
'$has_usage_context = $content_id > 0 || $folder_id > 0 || $slot !== \'\';')
32 && str_contains(
$cmsPhp,
'if ($has_usage_context'),
33 'The media API still exposes an arbitrary current usage without a usage context.'
36 str_contains(
$cmsJs,
'if (modal && modal.classList.contains("is-batch-open")) return true;')
37 && str_contains(
$cmsJs,
'return mode === "editor" || mode === "pick" || (mode === "assign"'),
38 'Batch selection in the editor media browser still replaces the previous image instead of collecting multiple images.'
41 str_contains(
$cmsCss,
'@media (min-width: 1181px)')
42 && str_contains(
$cmsCss,
'.dbx-cms:not(.dbx-cms-view) .dbx-cms-media-panel')
43 && str_contains(
$cmsCss,
'position: sticky;')
44 && str_contains(
$cmsCss,
'.dbx-cms:not(.dbx-cms-view) .dbx-cms-right-panel-content')
45 && str_contains(
$cmsCss,
'overflow-y: auto;'),
46 'The used-media sidebar can still scroll completely out of view on long pages.'
50 fwrite(STDERR,
"FAIL\n- " . implode(
"\n- ",
$failures) .
"\n");
54echo
'OK media browser usage reflects the current editor and all persisted usage slots.' . PHP_EOL;