feat: complete production backend integration
This commit is contained in:
@@ -96,3 +96,49 @@ test('exim worker suppresses automated messages and ignores unresolved recipient
|
||||
));
|
||||
assert_same(0, $sent);
|
||||
});
|
||||
|
||||
test('exim worker respects static mailbox snapshot scope', function (): void {
|
||||
$settingsPath = TEST_TMP . '/worker-snapshot-settings.conf';
|
||||
test_write($settingsPath, "GLOBAL_AUTORESPONDER_BACKEND=exim\nGLOBAL_AUTORESPONDER_REPLY_EVERY_MESSAGE=true\n");
|
||||
$settings = Settings::load($settingsPath);
|
||||
|
||||
$virtualRoot = TEST_TMP . '/worker-snapshot-virtual';
|
||||
test_write($virtualRoot . '/domainowners', "example.com: alice\n");
|
||||
test_write($virtualRoot . '/example.com/passwd', "info:x:1000:12::/home/alice/imap/example.com/info:/bin/false\nsales:x:1000:12::/home/alice/imap/example.com/sales:/bin/false\n");
|
||||
|
||||
$repo = new RuleRepository(TEST_TMP . '/worker-snapshot-data');
|
||||
$repo->create('alice', [
|
||||
'subject' => 'Urlop',
|
||||
'body' => 'Body',
|
||||
'start_ts' => 1,
|
||||
'end_ts' => 2000,
|
||||
'enabled' => true,
|
||||
'dynamic_scope' => false,
|
||||
'mailbox_snapshot' => [
|
||||
['domain' => 'example.com', 'mailbox' => 'info', 'email' => 'info@example.com'],
|
||||
],
|
||||
]);
|
||||
|
||||
$sent = 0;
|
||||
$worker = new GlobalAutoresponderWorker(
|
||||
$settings,
|
||||
$repo,
|
||||
new MailboxDirectory($virtualRoot),
|
||||
new RepeatState(TEST_TMP . '/worker-snapshot-state', 1000),
|
||||
static function () use (&$sent): bool {
|
||||
$sent++;
|
||||
return true;
|
||||
},
|
||||
1000
|
||||
);
|
||||
|
||||
assert_same(0, $worker->handle(
|
||||
['SENDER_ADDRESS' => 'person@example.net', 'RECIPIENT' => 'sales@example.com'],
|
||||
"Auto-Submitted: no\n\nBody"
|
||||
));
|
||||
assert_same(1, $worker->handle(
|
||||
['SENDER_ADDRESS' => 'person@example.net', 'RECIPIENT' => 'info@example.com'],
|
||||
"Auto-Submitted: no\n\nBody"
|
||||
));
|
||||
assert_same(1, $sent);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user