dbxapp
4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
dbxapp.de
Portal
Start
Anwender
Entwickler
KI-Bereiche
Loading...
Searching...
No Matches
dbxForm_callback_defaults_test.php
Go to the documentation of this file.
1
<?php
2
3
require_once dirname(__DIR__, 2) .
'/vendor/autoload.php'
;
4
require_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
11
dbx
()->get_system_obj(
'dbxForm'
,
'load'
);
12
dbx
()->get_system_obj(
'dbxReport'
,
'load'
);
13
14
class
dbxFormCallbackDefaultsOwner
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
24
$owner
=
new
dbxFormCallbackDefaultsOwner
();
25
$form
=
$owner
->createForm();
26
$ownerProperty
= (
new
ReflectionClass(
'dbxObj'
))->getProperty(
27
'_callback_owner'
28
);
29
$ownerProperty
->setAccessible(
true
);
30
31
if
(
$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'
);
36
if
(
$form
->replaces(
'Summe: {total}'
) !==
'Summe: 12,30 EUR'
) {
37
$fail
(
'Spaete dbxForm-Replacements werden nicht angewendet.'
, 2);
38
}
39
if
(
$form
->replaces(
'{value}'
, array(
'value'
=>
'explizit'
)) !==
'explizit'
) {
40
$fail
(
'Explizite dbxForm-Replacements werden nicht angewendet.'
, 3);
41
}
42
43
$report
=
new
dbxReport
();
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
);
49
if
(
$footer
!==
'<th colspan="5">47,30 EUR</th>'
) {
50
$fail
(
'dbxReport erbt Replacements oder Standard-Colspan nicht.'
, 4);
51
}
52
53
echo
"OK dbxForm callback defaults and report replacements\n"
;
dbxFormCallbackDefaultsOwner
Definition
dbxForm_callback_defaults_test.php:15
dbxFormCallbackDefaultsOwner\createForm
createForm()
Definition
dbxForm_callback_defaults_test.php:16
dbxForm
Definition
dbxForm.class.php:206
dbxReport
Definition
dbxDBexport.class.php:118
$form
$form
Definition
dbxActionTokenAutomation_test.php:260
$fail
$fail
Definition
dbxActionTokenAutomation_test.php:6
$report
if((string)($formActionPolicy['action'] ?? '') !=='dbxAction.save'||!dbx() ->check_action_token((string)($formActionPolicy['scope'] ?? ''),(string)($formActionRoute['params']['dbx_token'] ?? ''))) $report
Definition
dbxActionTokenAutomation_test.php:275
$form
$form
Definition
dbxForm_callback_defaults_test.php:25
$fail
$fail
Definition
dbxForm_callback_defaults_test.php:6
$ownerProperty
$ownerProperty
Definition
dbxForm_callback_defaults_test.php:26
$owner
$owner
Definition
dbxForm_callback_defaults_test.php:24
$footer
$footer
Definition
dbxForm_callback_defaults_test.php:46
exit
exit
Definition
index.php:146
dbx
DBX schema administration.
dbx
include
tests
dbxForm_callback_defaults_test.php
Generated by
1.17.0