dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxCmsMediaBrowserUsage_contract_test.php
Go to the documentation of this file.
1<?php
2
3$base = dirname(__DIR__, 2);
4$failures = array();
5
6$assert = static function(bool $condition, string $message) use (&$failures): void {
7 if (!$condition) $failures[] = $message;
8};
9
10$cmsJs = (string)file_get_contents($base . '/js/lib/cms.js');
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');
13
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.'
19);
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.'
25);
27 !str_contains($cmsJs, '.sort((a, b) => a - b)\n .join(",");'),
28 'The used-media signature still discards the actual editor order.'
29);
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.'
34);
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.'
39);
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.'
47);
48
49if ($failures !== array()) {
50 fwrite(STDERR, "FAIL\n- " . implode("\n- ", $failures) . "\n");
51 exit(1);
52}
53
54echo 'OK media browser usage reflects the current editor and all persisted usage slots.' . PHP_EOL;
exit
Definition index.php:146