dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxModuleMailSender_test.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5$root = dirname(__DIR__, 4);
6
7function module_mail_sender_assert(bool $condition, string $message): void
8{
9 if (!$condition) {
10 throw new RuntimeException($message);
11 }
12}
13
14$config = array();
15require $root . '/dbx/modules/dbxContact/cfg/config.php';
17
18$config = array();
19require $root . '/dbx/modules/dbxShop/cfg/config.php';
21
22$contactForm = (string)file_get_contents(
23 $root . '/dbx/modules/dbxContact/include/dbxContactForm.class.php'
24);
25$contactAdmin = (string)file_get_contents(
26 $root . '/dbx/modules/dbxContact_admin/include/dbxContactAdmin.class.php'
27);
28$shopService = (string)file_get_contents(
29 $root . '/dbx/modules/dbxShop/include/dbxShopService.class.php'
30);
31$shopAdmin = (string)file_get_contents(
32 $root . '/dbx/modules/dbxShop_admin/include/dbxShopAdmin.class.php'
33);
34$installer = (string)file_get_contents(
35 $root . '/dbx/modules/dbxSetup/include/dbxInstall.class.php'
36);
37require_once $root . '/dbx/modules/dbxSetup/include/dbxInstall.class.php';
38
40 ($contactConfig['mail_from'] ?? '') === ''
41 && ($contactConfig['mail_profile'] ?? '') === 'dbxApp',
42 'Das Kontaktmodul muss den installationsbezogenen Absender in der lokalen Konfiguration erwarten.'
43);
45 substr_count($contactForm, "get_config('dbxContact', 'mail_from')") >= 1
46 && str_contains($contactForm, '$this->mail_from_param()')
47 && str_contains($contactForm, 'FILTER_VALIDATE_EMAIL')
48 && str_contains($contactForm, "'reply_to'")
49 && str_contains($contactAdmin, "get_config('dbxContact', 'mail_from')")
50 && str_contains($contactAdmin, 'FILTER_VALIDATE_EMAIL')
51 && str_contains($contactAdmin, '$fromParam'),
52 'Kontaktbenachrichtigung, Bestätigung oder Supportantwort umgehen mail_from.'
53);
54
56 ($shopConfig['mail_from'] ?? '') === 'shop@dbxapp.de'
57 && ($shopConfig['mail_profile'] ?? '') === 'dbxApp'
58 && ($shopConfig['mail_from_name'] ?? '') === 'dbxShop',
59 'Das Shopmodul besitzt nicht den erwarteten konfigurierbaren Standardabsender.'
60);
62 !str_contains($shopService, "\$from = 'shop@dbxapp.de'")
63 && str_contains($shopService, "\$cfg['mail_from']")
64 && str_contains($shopService, 'shopMailOptions')
65 && str_contains($shopService, "\$extra['mail_profile'] = \$profile")
66 && substr_count($shopService, '$mailOptions') >= 5,
67 'Bestell- oder Widerrufsmails nutzen nicht durchgehend die Shop-Konfiguration.'
68);
70 str_contains($shopAdmin, "patch_local_config('dbxShop', \$mailLocal)")
71 && str_contains($shopAdmin, "\$cfg['mail_from_name']")
72 && str_contains($shopAdmin, "'mail_profile' => \$profile")
73 && str_contains($shopAdmin, 'if (!$sent)'),
74 'Shop-Einstellungen oder Statusmails verwenden die lokale Absenderkonfiguration nicht vollständig.'
75);
76
78 str_contains($installer, "patch_local_config('dbxContact'")
79 && str_contains($installer, "patch_local_config('dbxShop'")
80 && str_contains($installer, "moduleSenderAddress('kontakt'")
81 && str_contains($installer, "moduleSenderAddress('shop'")
82 && str_contains($installer, 'Kontaktanfragen')
83 && str_contains($installer, 'Shop-Nachrichten'),
84 'Der Installer konfiguriert die getrennten Modulabsender nicht vollständig.'
85);
86
87$installerClass = new ReflectionClass('dbx\\dbxSetup\\dbxInstall');
88$installerObject = $installerClass->newInstanceWithoutConstructor();
89$moduleSender = $installerClass->getMethod('moduleSenderAddress');
91 $moduleSender->invoke($installerObject, 'kontakt', 'admin@kunde.example') === 'kontakt@kunde.example'
92 && $moduleSender->invoke($installerObject, 'shop', 'system@kunde.example') === 'shop@kunde.example'
93 && $moduleSender->invoke($installerObject, 'shop', '') === 'shop@dbxapp.de',
94 'Die Modulabsender werden nicht korrekt aus der globalen Absenderdomain abgeleitet.'
95);
96
97echo "OK configurable contact and shop mail senders\n";
if($failed !==array()) $installer
if($resolved !==$expectedBase . 'files/test/') $config
module_mail_sender_assert(bool $condition, string $message)