dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxCmsMediaBrowserPerformance_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, 'mediaParams.sync = 0;')
16 && str_contains($cmsJs, 'mediaParams.limit = 28;')
17 && str_contains($cmsJs, 'const folderRefresh = new Promise(resolve => window.setTimeout(resolve, 250))')
18 && str_contains($cmsJs, '.then(() => refreshMediaFolderControls(root, cfg, modal))')
19 && str_contains($cmsJs, 'fetchJson(apiUrl(mediaUrl, mediaParams)'),
20 'The initial media request is still blocked by a full filesystem sync or folder scan.'
21);
23 str_contains($cmsJs, 'const loadRemaining = () => {')
24 && str_contains($cmsJs, 'limit: 84,')
25 && str_contains($cmsJs, 'rows.push(row);'),
26 'Remaining media are not loaded dynamically after the visible first page.'
27);
29 str_contains($cmsPhp, '$select_limit = $limit > 0 ? $limit + 1 : 0;')
30 && str_contains($cmsPhp, "'has_more' => \$has_more ? 1 : 0")
31 && str_contains($cmsPhp, "'next_offset' => \$limit > 0"),
32 'The media API does not support fast paginated responses.'
33);
35 str_contains($cmsPhp, "' AND media_id IN (' . implode(',', \$page_media_ids) . ')'")
36 && str_contains($cmsPhp, 'if ($limit <= 0) $rows = $this->filter_existing_media($db, $rows);'),
37 'Paginated media requests still scan every usage row or every media file.'
38);
40 str_contains($cmsJs, 'modal.__dbxCmsFilteredRows = filtered;')
41 && str_contains($cmsJs, 'const sourceRows = Array.isArray(browserModal.__dbxCmsFilteredRows)')
42 && str_contains($cmsJs, '<span>Alle angezeigten resizen</span>'),
43 'Batch resize still renders or processes the complete media library instead of the currently displayed filter.'
44);
46 str_contains($cmsJs, 'data-cms-media-edit-status aria-live="polite"')
47 && str_contains($cmsJs, 'function reportMediaEditStatus(root, modal, message, type)')
48 && str_contains($cmsCss, '.dbx-cms-media-edit-status.is-success'),
49 'Image resize and crop feedback is still hidden behind the active editor dialog.'
50);
52 str_contains($cmsJs, 'Array.from(qs(modal, "[data-cms-upload-folder]")?.options || [])')
53 && str_contains($cmsJs, '.filter(folder => folder.indexOf("img/") === 0);'),
54 'Media maintenance has no immediate folder fallback while the asynchronous folder refresh is running.'
55);
56
57if ($failures !== array()) {
58 fwrite(STDERR, "FAIL\n- " . implode("\n- ", $failures) . "\n");
59 exit(1);
60}
61
62echo 'OK media browser renders the first page quickly and loads the rest dynamically.' . PHP_EOL;
exit
Definition index.php:146