dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxDashboard_default_admin_warning_test.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5$module = dirname(__DIR__);
6$dbxRoot = dirname(__DIR__, 3);
7
8if (!defined('dbxSystem')) {
9 define('dbxSystem', 'dbxWebApp');
10}
11if (!defined('dbxRunAsAdmin')) {
12 define('dbxRunAsAdmin', 1);
13}
14
15require_once $dbxRoot . '/vendor/autoload.php';
16require_once $dbxRoot . '/include/dbxKernel.php';
17require_once $module . '/include/dbxDashboard.class.php';
18
19$source = (string)file_get_contents(
20 $module . '/include/dbxDashboard.class.php'
21);
22$template = (string)file_get_contents(
23 $module . '/tpl/htm/admin-dashboard.htm'
24);
25$style = (string)file_get_contents(
26 $module . '/tpl/css/admin-dashboard.css'
27);
28
30 bool $condition,
31 string $message
32): void {
33 if (!$condition) {
34 throw new RuntimeException($message);
35 }
36}
37
39 str_contains($source, 'default_admin_password_warning')
40 && str_contains($source, "array('uname' => 'admin')")
41 && str_contains($source, "password_verify('123456', \$hash)")
42 && str_contains($source, 'Unsicheres Installationspasswort aktiv')
43 && str_contains($source, 'dbx_run2=edit_user')
44 && str_contains($source, 'Passwort ändern'),
45 'Das Admin-Dashboard erkennt oder verlinkt admin/123456 nicht vollständig.'
46);
48 str_contains($template, '{obj:dashboard_message}'),
49 'Die Sicherheitswarnung besitzt keinen Platz im Dashboard.'
50);
52 str_contains($style, '.dbx-admin-dashboard-password-warning')
53 && str_contains($style, '@media (max-width: 720px)'),
54 'Die Sicherheitswarnung ist nicht responsiv gestaltet.'
55);
56
57$class = new ReflectionClass('dbx\\dbxAdmin\\dbxDashboard');
58$dashboard = $class->newInstanceWithoutConstructor();
59$renderWarning = $class->getMethod('default_admin_password_warning_html');
62 27,
63 password_hash('123456', PASSWORD_DEFAULT)
64);
66 str_contains($warning, 'Unsicheres Installationspasswort aktiv')
67 && str_contains($warning, 'rid=27')
68 && str_contains($warning, 'dbx_run2=edit_user')
69 && str_contains($warning, 'Passwort ändern'),
70 'Ein aktives Standardpasswort erzeugt keine vollständige Dashboard-Warnung.'
71);
73 $renderWarning->invoke(
75 27,
76 password_hash('Persoenlich-2026!', PASSWORD_DEFAULT)
77 ) === '',
78 'Die Dashboard-Warnung bleibt nach einem persönlichen Passwort sichtbar.'
79);
80
81echo "OK admin dashboard default password warning\n";
$dbxRoot
Regressionstest für benannte Submit-Schaltflächen in AJAX-Formularen.
dashboard_admin_warning_assert(bool $condition, string $message)
if(!defined( 'IMG_WEBP')) define( 'IMG_WEBP'