dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxMediaUsageLanguage_contract_test.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
4$root = dirname(__DIR__, 3);
5$failures = array();
6$check = static function(bool $condition, string $message) use (&$failures): void {
7 if (!$condition) $failures[] = $message;
8};
9
10$dd = (string)file_get_contents($root . '/dbx/modules/dbx/dd/dbxMediaUsage.dd.php');
11$cms = (string)file_get_contents($root . '/dbx/modules/dbxContent_admin/include/dbxContent_cms.class.php');
12$renderer = (string)file_get_contents($root . '/dbx/modules/dbxContent/include/dbxContentRenderer.class.php');
13$scope = (string)file_get_contents($root . '/dbx/modules/dbxContent/include/dbxContentMediaUsageScope.class.php');
14$shop = (string)file_get_contents($root . '/dbx/modules/dbxShop_admin/include/dbxShopAdmin.class.php');
15$ki = (string)file_get_contents($root . '/dbx/modules/dbxKi/include/dbxKiCmsService.class.php');
16$migrationPath = $root . '/dbx/modules/dbx/migrations/4.1.0-001-media-usage-language.migration.php';
17$migration = is_file($migrationPath) ? (string)file_get_contents($migrationPath) : '';
18$repairMigrationPath = $root . '/dbx/modules/dbx/migrations/4.1.2-001-media-usage-schema-repair.migration.php';
20 ? (string)file_get_contents($repairMigrationPath)
21 : '';
22
23$check(str_contains($dd, "\$field['name']='content_lng'"), 'dbxMediaUsage must persist the language of its content target.');
24$check(str_contains($dd, 'idx_media_usage_lng_context'), 'The language/context lookup must be indexed.');
25$check(is_file($migrationPath), 'The 4.1.0 media-usage migration is missing.');
26$check(
27 str_contains($migration, "require_once dirname(__DIR__, 2) . '/dbxContent/include/dbxContentMediaUsageScope.class.php'"),
28 'The media-usage migration must load new release dependencies from its own staged tree.'
29);
30$check(is_file($repairMigrationPath), 'The 4.1.2 media-usage schema repair migration is missing.');
31$check(
32 str_contains($repairMigration, "'core-4.1.2-media-usage-schema-repair'")
33 && str_contains($repairMigration, 'content_lng wurde physisch nicht angelegt')
34 && str_contains($repairMigration, "sync_dd_to_db('dbx', 'dbxMediaUsage', 'apply')"),
35 'The repair migration must enforce and verify the physical language schema.'
36);
37$check(str_contains($cms, "slot IN ('hero','gallery','header','teaser','footer')"), 'Page copying must use an explicit copy-slot allowlist.');
38$check(!str_contains($cms, "active = 1 AND slot <> 'inline'"), 'Page copying must never select every non-inline slot (that copied shop data).');
39$check(str_contains($cms, 'dbxContentMediaUsageScope::withLanguage'), 'CMS usage reads and writes must be language scoped.');
40$check(str_contains($renderer, 'dbxContentMediaUsageScope::withLanguage'), 'Frontend rendering must be language scoped.');
41$check(
42 str_contains($scope, 'if (!class_exists(dbxContentMediaUsageScope::class, false))'),
43 'The staged media-usage scope must be safe to include when the active release already loaded the class.'
44);
45$check(str_contains($shop, "'content_lng' => \$this->shopMediaUsageLng()"), 'Shop usage must be assigned to the stable master language.');
46$check(str_contains($shop, "\$db->delete(") && str_contains($shop, 'sourceNeedle'), 'Shop synchronization must replace its own snapshot instead of accumulating inactive rows.');
47$check(str_contains($ki, "slot IN ('hero','gallery','inline','header','teaser','footer')"), 'KI page translation/copy must exclude the shop slot.');
48$check(str_contains($cms, 'RecursiveDirectoryIterator') && str_contains($cms, "'/media/_thumbs/'"), 'Thumbnail maintenance must scan the real thumbnail tree recursively.');
49
51 fwrite(STDERR, "FAIL\n- " . implode("\n- ", $failures) . "\n");
52 exit(1);
53}
54
55echo "OK multilingual media-usage, copy, shop and thumbnail contracts.\n";
exit
Definition index.php:146