dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxForm_callback_defaults_test.php
Go to the documentation of this file.
1<?php
2
3require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
4require_once dirname(__DIR__) . '/dbxKernel.php';
5
6$fail = static function (string $message, int $code): void {
7 fwrite(STDERR, "FAIL: $message\n");
8 exit($code);
9};
10
11dbx()->get_system_obj('dbxForm', 'load');
12dbx()->get_system_obj('dbxReport', 'load');
13
15{
16 public function createForm(): dbxForm
17 {
18 $form = new dbxForm();
19 $form->init('callback-default-form', 'callback-default-form');
20 return $form;
21 }
22}
23
25$form = $owner->createForm();
26$ownerProperty = (new ReflectionClass('dbxObj'))->getProperty(
27 '_callback_owner'
28);
29$ownerProperty->setAccessible(true);
30
31if ($ownerProperty->getValue($form) !== $owner) {
32 $fail('dbxForm uebernimmt den direkten Aufrufer nicht als Owner.', 1);
33}
34
35$form->add_rep('total', '12,30 EUR');
36if ($form->replaces('Summe: {total}') !== 'Summe: 12,30 EUR') {
37 $fail('Spaete dbxForm-Replacements werden nicht angewendet.', 2);
38}
39if ($form->replaces('{value}', array('value' => 'explizit')) !== 'explizit') {
40 $fail('Explizite dbxForm-Replacements werden nicht angewendet.', 3);
41}
42
44$report->_table_col_count = 6;
45$report->add_rep('total', '47,30 EUR');
46$footer = $report->rpt_merge_obj(
47 '<th colspan="{rpt:colspan}">{total}</th>'
48);
49if ($footer !== '<th colspan="5">47,30 EUR</th>') {
50 $fail('dbxReport erbt Replacements oder Standard-Colspan nicht.', 4);
51}
52
53echo "OK dbxForm callback defaults and report replacements\n";
if((string)($formActionPolicy['action'] ?? '') !=='dbxAction.save'||!dbx() ->check_action_token((string)($formActionPolicy['scope'] ?? ''),(string)($formActionRoute['params']['dbx_token'] ?? ''))) $report
exit
Definition index.php:146
DBX schema administration.