dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxActiveUiLanguageContract_test.php
Go to the documentation of this file.
1<?php
2
10
11$root = dirname(__DIR__, 2);
12
13$fail = static function (string $message): void {
14 fwrite(STDERR, "FAIL: {$message}\n");
15 exit(1);
16};
17
18$contracts = array(
19 'modules/dbxShop/include/dbxShopService.class.php' => array(
20 "texts('dbxShop|shop-catalog-filter-form')",
21 "texts('dbxShop|shop-cart')",
22 "texts('dbxShop|checkout')",
23 "texts('dbxShop|shop-orders')",
24 "get_fd_message('column_product')",
25 "get_fd_message('payment_bank_transfer_help')",
26 "get_fd_message('empty_title')",
27 ),
28 'modules/dbxAdmin/include/dbxServer.class.php' => array(
29 "\$texts->_fd = 'dbxAdmin|server'",
30 "\$oReport->_fd = 'dbxAdmin|server'",
31 "\$oForm->_fd = 'dbxAdmin|server'",
32 "get_fd_message('column_table')",
33 "get_fd_message('check_input_plain')",
34 ),
35 'modules/dbxAdmin/include/dbxSchema.class.php' => array(
36 "'dbxAdmin|schema-report'",
37 "get_fd_message('mapping_saved')",
38 "get_fd_message('action_save')",
39 ),
40 'modules/dbxAdmin/include/dbxEdit_fd.class.php' => array(
41 "'dbxAdmin|ddedit-field'",
42 'load_fd_messages()',
43 ),
44 'modules/dbxUser/include/dbxUser_profil.class.php' => array(
45 "'dbxUser|user-profile'",
46 'load_fd_messages()',
47 ),
48 'modules/dbxUser/include/dbxUser_avatar.class.php' => array(
49 "'dbxUser|user-profile'",
50 'load_fd_messages()',
51 ),
52 'modules/myInvoices/include/myInvoicesService.class.php' => array(
53 'self::FORM_FD',
54 'self::REPORT_FD',
55 "get_fd_message('column_invoice_no')",
56 "'delete_question',",
57 ),
58);
59
60foreach ($contracts as $relative => $requiredFragments) {
61 $path = $root . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $relative);
62 $source = is_file($path) ? file_get_contents($path) : false;
63 if (!is_string($source)) {
64 $fail("Datei fehlt: {$relative}");
65 }
66 foreach ($requiredFragments as $fragment) {
67 if (!str_contains($source, $fragment)) {
68 $fail("{$relative}: FD-Vertrag fehlt: {$fragment}");
69 }
70 }
71 if (
72 preg_match(
73 '~_msg_(?:info|success|error|warning)\s*=\s*([\'"])(?!\1)(?:(?!\1).)+\1~',
74 $source,
75 $match
76 )
77 ) {
78 $fail("{$relative}: sichtbare Meldung ist noch im Modul hart codiert: {$match[0]}");
79 }
80}
81
82$shopSource = file_get_contents(
83 $root . '/modules/dbxShop/include/dbxShopService.class.php'
84);
85foreach (array(
86 'Shop Cart Report',
87 'Shop Checkout Form',
88 'Noch keine Bestellungen',
89 'Ihre gespeicherten Shop-Bestellungen.',
90 'Aktuell ist keine Zahlungsart aktiv',
91) as $obsoleteText) {
92 if (str_contains($shopSource, $obsoleteText)) {
93 $fail("dbxShopService enthält noch statischen UI-Text: {$obsoleteText}");
94 }
95}
96
97$coreJs = file_get_contents($root . '/js/lib/core.js');
98$confirmJs = file_get_contents($root . '/js/lib/confirm.js');
99if (
100 !str_contains((string)$coreJs, 'dbx.translate') ||
101 !str_contains((string)$confirmJs, 'dbx.translate')
102) {
103 $fail('Zentrale JavaScript-Bedientexte verwenden dbx.translate() nicht.');
104}
105
106echo 'OK: Aktive Kernformulare und -listen beziehen Fachtexte aus ihren Sprach-FDs; '
107 . "generische Browsertexte verwenden dbx.translate().\n";
foreach(array('Shop Cart Report', 'Shop Checkout Form', 'Noch keine Bestellungen', 'Ihre gespeicherten Shop-Bestellungen.', 'Aktuell ist keine Zahlungsart aktiv',) as $obsoleteText) $coreJs
foreach($contracts as $relative=> $requiredFragments) $shopSource
exit
Definition index.php:146