fix: match directadmin vacation controls

This commit is contained in:
Marek Miklewicz
2026-06-03 09:21:51 +02:00
parent 0617798821
commit 9174d62706
12 changed files with 176 additions and 53 deletions
+18 -8
View File
@@ -59,11 +59,12 @@ test('rule form uses minute time input and no summary box in exim mode', functio
assert_contains(': pierwotny temat', $html);
assert_contains('Częstość odpowiedzi', $html);
assert_contains('Wysyłaj automatyczną odpowiedź dla każdej wiadomości', $html);
assert_contains('14 dni', $html);
assert_contains('1 dzień', $html);
assert_contains('Treść wiadomości', $html);
});
test('rule form uses native period selector in da mode', function (): void {
test('rule form uses exact hour selector and directadmin frequency range in da mode', function (): void {
$settingsPath = TEST_TMP . '/form-da.conf';
test_write($settingsPath, "DEFAULT_PLUGIN_LANGUAGE=pl\nGLOBAL_AUTORESPONDER_BACKEND=da\n");
$settings = Settings::load($settingsPath);
@@ -76,9 +77,18 @@ test('rule form uses native period selector in da mode', function (): void {
new AuditLog(TEST_TMP . '/audit.log')
);
$html = render_rule_form($ctx, 'create', null);
assert_contains('name="start_value_period"', $html);
assert_contains('Rano', $html);
assert_false(strpos($html, 'type="time"') !== false);
assert_contains('type="time"', $html);
assert_contains('step="60"', $html);
assert_contains('1 minuta', $html);
assert_contains('14 dni', $html);
assert_false(strpos($html, 'Wysyłaj automatyczną odpowiedź dla każdej wiadomości') !== false);
assert_false(strpos($html, 'name="start_value_period"') !== false);
});
test('autoresponder table does not expose mailbox scope column', function (): void {
$source = file_get_contents(PLUGIN_ROOT . '/exec/handlers/index.php') ?: '';
assert_false(strpos($source, "ctx->t('Scope')") !== false);
assert_false(strpos($source, "ctx->t(\$rule['dynamic_scope']") !== false);
});
test('mutating handlers synchronize active backend after storage changes', function (): void {
@@ -155,8 +165,8 @@ test('new rule form selects current date for start and end calendars by default'
assert_contains('id="start_value_date" name="start_value_date" value="' . $today . '"', $html);
assert_contains('id="end_value_date" name="end_value_date" value="' . $today . '"', $html);
assert_contains('id="start_value" name="start_value" value="' . $today . 'T09:00"', $html);
assert_contains('id="end_value" name="end_value" value="' . $today . 'T17:00"', $html);
assert_contains('id="start_value" name="start_value" value="' . $today . 'T00:00"', $html);
assert_contains('id="end_value" name="end_value" value="' . $today . 'T23:59"', $html);
});
test('rule form localizes calendar and preview labels without translating user content globally', function (): void {
@@ -194,8 +204,8 @@ test('directadmin backend allows only one enabled global rule per account', func
'repeat_minutes' => 1440,
'body' => 'Body',
'enabled' => true,
'start_value' => '2026-06-10|morning',
'end_value' => '2026-06-24|evening',
'start_value' => '2026-06-10T00:00',
'end_value' => '2026-06-24T23:59',
]);
$ctx = new AppContext(
new DirectAdminUser('alice', 'enhanced', 'pl', TEST_TMP . '/config'),