7$fail =
function (
string $message,
int $code): void {
8 fwrite(STDERR,
"FAIL: $message\n");
13 'myInvoices.class.php',
16 'dd/invoiceItem.dd.php',
17 'fd/invoice-form.fd.php',
18 'fd/rpt-invoice-selection.fd.php',
19 'include/myInvoicesFixtures.class.php',
20 'include/myInvoicesService.class.php',
21 'tpl/htm/invoice-form.htm',
22 'tpl/htm/invoice-report.htm',
23 'tpl/htm/invoice-items-report.htm',
24 'tpl/htm/invoice-row-action.htm',
25 'tpl/htm/invoice-install.htm',
26 'tools/install_demo.php',
27 'tests/myInvoices_integration_test.php',
31 if (!is_file(
$module .
'/' . $relative)) {
32 $fail(
'Datei fehlt: ' . $relative, 1);
36foreach (array(
'dd/invoice.dd.php',
'dd/invoiceItem.dd.php') as $relative) {
38 if (!preg_match(
'/\$table\[\'trace\'\]\s*=\s*\'0\';/',
$source)) {
39 $fail($relative .
': produktives DD muss trace=0 verwenden.', 2);
41 if (strpos(
$source,
'$addField') !==
false) {
42 $fail($relative .
': DD-Felder muessen explizit definiert sein.', 2);
53 ) as $requiredDdPart) {
54 if (strpos(
$source, $requiredDdPart) ===
false) {
56 $relative .
': expliziter DD-Bestandteil fehlt: '
66 'myInvoices.class.php',
67 'include/myInvoicesFixtures.class.php',
68 'include/myInvoicesService.class.php',
73 token_get_all(
$source, TOKEN_PARSE);
74 }
catch (ParseError $exception) {
75 $fail($relative .
': ' . $exception->getMessage(), 3);
82 '/->(?:query|exec|prepare)\s*\(/',
83 '/\b(?:SELECT|INSERT|UPDATE|DELETE)\s+(?:FROM|INTO|SET)\b/i',
86 $fail(
'Direkter Datenbankzugriff gefunden: ' . $forbidden, 4);
91 '/private function (?:db|tpl|form|report)\s*\([^)]*\)\s*\{'
92 .
'\s*return\s+dbx\(\)->get_(?:system|include)_obj/s',
95 $fail(
'Unnötiger dbx-Wrapper gefunden.', 5);
99 $module .
'/include/myInvoicesFixtures.class.php'
109 '/[\'"]' . preg_quote($systemField,
'/') .
'[\'"]\s*=>/',
113 'Fixture setzt dbxDB-Systemfeld manuell: ' . $systemField,
120 $module .
'/include/myInvoicesService.class.php'
123 "get_system_obj('dbxDB')",
124 "get_system_obj('dbxForm')",
125 "get_system_obj('dbxReport')",
126 "get_system_obj('dbxTPL')",
127 'invoice_report_next_record',
128 'invoice_items_report_next_record',
129 "add_rep(\n 'report_total'",
130 '[modul=myInvoices]dbx_run1=positions&invoice_id=',
132 '->begin(self::INVOICE_DD)',
133 '->commit(self::INVOICE_DD)',
134 '->rollback(self::INVOICE_DD)',
135) as $requiredSource) {
136 if (strpos(
$service, $requiredSource) ===
false) {
137 $fail(
'Servicevertrag fehlt: ' . $requiredSource, 7);
142if (strpos(
$config,
'action_routes') !==
false) {
143 $fail(
'Automatisch erkennbare RID-Aktion ist noch manuell konfiguriert.', 8);
145if (strpos(
$service,
'check_action_token') !==
false
146 || strpos(
$service,
'action_token(') !==
false
148 $fail(
'Service verwaltet Action-Tokens noch manuell.', 8);
151 'set_callback_owner(',
152 'set_next_record_callback(',
153 'set_footer_callback(',
154 'renderInvoiceFooter',
157) as $unnecessaryCallbackCode) {
158 if (strpos(
$service, $unnecessaryCallbackCode) !==
false) {
160 'Service umgeht Callback-Defaults: ' . $unnecessaryCallbackCode,
167 $module .
'/tpl/htm/invoice-items-report.htm'
170 $fail(
'Eingebetteter Positionsreport enthält ein Formular.', 8);
173 '<hr class="dbx_split">',
176) as $requiredTemplate) {
178 $fail(
'Positionsreport-Vertrag fehlt: ' . $requiredTemplate, 9);
183 $module .
'/tpl/htm/invoice-row-action.htm'
185foreach (array(
'dbxAjax',
'dbxConfirm',
'data-confirm-buttons="yesno"') as $part) {
187 $fail(
'Action-Vertrag fehlt: ' . $part, 10);
191echo
"OK myInvoices architecture contract\n";
if($resolved !==$expectedBase . 'files/test/') $config
if(strpos($config, 'action_routes') !==false) if(strpos( $service, 'check_action_token') !==false||strpos( $service, 'action_token(') !==false) foreach(array('set_callback_owner(', 'set_next_record_callback(', 'set_footer_callback(', 'renderInvoiceFooter', 'renderItemFooter', 'str_replace(',) as $unnecessaryCallbackCode) $itemTemplate
foreach( $required as $relative) foreach(array('dd/invoice.dd.php', 'dd/invoiceItem.dd.php') as $relative) $phpSources
foreach(array('myInvoices.class.php', 'include/myInvoicesFixtures.class.php', 'include/myInvoicesService.class.php',) as $relative) foreach(array('/\bPDO\b/', '/\bmysqli?_/', '/->(?:query|exec|prepare)\s *\(/', '/\b(?:SELECT|INSERT|UPDATE|DELETE)\s+(?:FROM|INTO|SET)\b/i',) as $forbidden) if(preg_match('/private function(?:db|tpl|form|report)\s *\( $fixtureSource[^)] *\)\s *\{' . '\s *return\s+dbx\(\) ->get_(?:system|include) _obj/s', $phpSources))
if(stripos( $itemTemplate, '< form') !==false) foreach(array('< hr class="dbx_split">', '{rpt:colspan}', '{report_total}',) as $requiredTemplate) $actionTemplate