feat: complete production backend integration

This commit is contained in:
Marek Miklewicz
2026-06-02 20:51:57 +02:00
parent d3f2fd69db
commit 4b531a4c24
20 changed files with 853 additions and 40 deletions
+36
View File
@@ -76,3 +76,39 @@ test('rule form uses native period selector in da mode', function (): void {
assert_contains('Rano', $html);
assert_false(strpos($html, 'type="time"') !== false);
});
test('mutating handlers synchronize active backend after storage changes', function (): void {
foreach (['create.php', 'update.php', 'delete.php', 'toggle.php'] as $handler) {
$source = file_get_contents(PLUGIN_ROOT . '/exec/handlers/' . $handler) ?: '';
assert_contains('syncActiveBackend', $source, $handler . ' must synchronize backend after mutation');
}
});
test('calendar picker is based on selected rule month and supports month navigation', function (): void {
$settingsPath = TEST_TMP . '/form-calendar.conf';
test_write($settingsPath, "DEFAULT_PLUGIN_LANGUAGE=pl\nGLOBAL_AUTORESPONDER_BACKEND=exim\n");
$settings = Settings::load($settingsPath);
$ctx = new AppContext(
new DirectAdminUser('alice', 'enhanced', 'pl', TEST_TMP . '/config'),
$settings,
new RuleRepository(TEST_TMP . '/data'),
new CsrfGuard('secret', 'alice', 'sid'),
Lang::load('pl', $settings),
new AuditLog(TEST_TMP . '/audit.log')
);
$html = render_rule_form($ctx, 'update', [
'id' => 'abc',
'subject' => 'Urlop',
'body' => 'Body',
'enabled' => true,
'start_value' => '2027-02-14T20:00',
'end_value' => '2027-03-01T09:30',
]);
assert_contains('data-calendar-picker', $html);
assert_contains('data-calendar-prev', $html);
assert_contains('data-calendar-next', $html);
assert_contains('Luty 2027', $html);
assert_false(strpos($html, 'Czerwiec 2026') !== false);
});