dbxapp
4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
dbxapp.de
Portal
Start
Anwender
Entwickler
KI-Bereiche
Loading...
Searching...
No Matches
dbxContentDoxygenTutorialExport_test.php
Go to the documentation of this file.
1
<?php
2
3
$appRoot
= dirname(__DIR__, 4);
4
$exportFile
=
$appRoot
5
.
'/dbx/modules/dbxContent/tools/export_doxygen_tutorials_de.php'
;
6
7
if
(!is_file(
$exportFile
)) {
8
fwrite(STDERR,
"FAIL: Doxygen-Tutorial-Export fehlt.\n"
);
9
exit
(1);
10
}
11
12
$contentDatabase
=
$appRoot
.
'/dbx/modules/dbx/db/dbxContent.db3'
;
13
if
(!is_file(
$contentDatabase
) || filesize(
$contentDatabase
) === 0) {
14
$source
= (string)file_get_contents(
$exportFile
);
15
foreach
(array(
"'--write'"
,
"'--check'"
,
"get_system_obj('dbxDB')"
) as
$required
) {
16
if
(!str_contains(
$source
,
$required
)) {
17
fwrite(STDERR,
"FAIL: Portabler Tutorial-Exportvertrag ist unvollständig.\n"
);
18
exit
(2);
19
}
20
}
21
echo
"OK portable Doxygen tutorial export contract; local content fixtures are not part of the public checkout.\n"
;
22
exit
(0);
23
}
24
25
$originalArgv
=
$argv
?? array();
26
$argv
= array(
$exportFile
,
'--check'
);
27
28
ob_start();
29
require
$exportFile
;
30
$json
= (string)ob_get_clean();
31
$argv
=
$originalArgv
;
32
33
$result
= json_decode(
$json
,
true
);
34
if
(!is_array(
$result
)) {
35
fwrite(STDERR,
"FAIL: Export liefert kein gültiges JSON.\n"
);
36
exit
(2);
37
}
38
39
$expected
= array(
40
'mode'
=>
'check'
,
41
'language'
=>
'de'
,
42
'source_dd'
=>
'content_de'
,
43
'tutorial_pages'
=> 18,
44
);
45
foreach
(
$expected
as $key =>
$value
) {
46
if
((
$result
[$key] ??
null
) !==
$value
) {
47
fwrite(
48
STDERR,
49
'FAIL: Unerwarteter Exportwert für '
. $key .
': '
50
. json_encode(
$result
[$key] ??
null
, JSON_UNESCAPED_UNICODE)
51
.
"\n"
52
);
53
exit
(3);
54
}
55
}
56
57
$mediaLinks
= (int)(
$result
[
'media_usage_links'
] ?? 0);
58
if
(
$mediaLinks
<= 0
59
|| (
int
)(
$result
[
'unique_page_media_links'
] ?? -1) !==
$mediaLinks
60
|| (
int
)(
$result
[
'covered_page_media_links'
] ?? -1) !==
$mediaLinks
61
|| (
int
)(
$result
[
'unique_media_assets'
] ?? 0) <= 0
62
|| (
int
)(
$result
[
'unique_media_assets'
] ?? 0) >
$mediaLinks
) {
63
fwrite(STDERR,
"FAIL: Medienabdeckung des Tutorial-Exports ist inkonsistent.\n"
);
64
exit
(3);
65
}
66
67
if
((
$result
[
'missing_media'
] ??
null
) !== array()) {
68
fwrite(STDERR,
"FAIL: Dem Tutorial-Export fehlen Medien.\n"
);
69
exit
(4);
70
}
71
if
((
$result
[
'stale_files'
] ??
null
) !== array()) {
72
fwrite(STDERR,
"FAIL: Der Doxygen-Tutorialbestand ist nicht aktuell.\n"
);
73
exit
(5);
74
}
75
if
((
int
)(
$result
[
'written_pages'
] ?? -1) !== 0
76
|| (
int
)(
$result
[
'copied_assets'
] ?? -1) !== 0) {
77
fwrite(STDERR,
"FAIL: --check hat Dateien geschrieben.\n"
);
78
exit
(6);
79
}
80
81
echo
"OK dbxContent Doxygen tutorial export: "
82
.
$result
[
'tutorial_pages'
] .
' pages, '
83
.
$result
[
'unique_media_assets'
] .
" media assets\n"
;
$source
$source
Definition
dbxCmsEditorPerformance_contract_test.php:4
$exportFile
$exportFile
Definition
dbxContentDoxygenTutorialExport_test.php:4
$mediaLinks
foreach($expected as $key=> $value) $mediaLinks
Definition
dbxContentDoxygenTutorialExport_test.php:57
$appRoot
$appRoot
Definition
dbxContentDoxygenTutorialExport_test.php:3
$originalArgv
if(!is_file($contentDatabase)||filesize($contentDatabase)===0) $originalArgv
Definition
dbxContentDoxygenTutorialExport_test.php:25
$contentDatabase
if(!is_file($exportFile)) $contentDatabase
Definition
dbxContentDoxygenTutorialExport_test.php:12
$json
$json
Definition
dbxContentDoxygenTutorialExport_test.php:30
$expected
foreach( $iterator as $file) if(! $groups) $expected
Definition
dbxForm_fd_language_messages_test.php:56
$value
$value
Definition
dbxForm_validation_result_test.php:28
$result
$result
Definition
dbxForm_validation_result_test.php:29
$required
$required
Definition
dbxValidator_result_test.php:31
$argv
$argv
Definition
doxygen_utf8_filter_test.php:17
exit
exit
Definition
index.php:146
dbx
modules
dbxContent
tests
dbxContentDoxygenTutorialExport_test.php
Generated by
1.17.0