feat: implement global autoresponder plugin

This commit is contained in:
Marek Miklewicz
2026-06-02 19:19:00 +02:00
commit 6f989af278
62 changed files with 2018 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
require_once PLUGIN_ROOT . '/exec/lib/RuleRepository.php';
test('rule repository isolates users and stores rules atomically', function (): void {
$repo = new RuleRepository(TEST_TMP . '/data');
$rule = [
'subject' => 'Urlop',
'body' => 'Body',
'start_ts' => 1,
'end_ts' => 2,
'enabled' => true,
];
$created = $repo->create('alice', $rule);
assert_true(isset($created['id']));
assert_same(1, count($repo->all('alice')));
assert_same(0, count($repo->all('bob')));
try {
$repo->update('bob', $created['id'], ['subject' => 'Other']);
} catch (RuntimeException $e) {
assert_contains('not found', $e->getMessage());
return;
}
throw new RuntimeException('Expected cross-user update to fail');
});