Sync global-autoresponder current state
This commit is contained in:
@@ -29,24 +29,30 @@ test('shipped plugin files do not contain placeholders', function (): void {
|
||||
continue;
|
||||
}
|
||||
$content = file_get_contents($path) ?: '';
|
||||
if (preg_match('/placeholder|TODO|FIXME|not implemented|pending_exim_validation|stub/i', $content)) {
|
||||
if (preg_match('/placeholder|TODO|FIXME|not implemented|stub/i', $content)) {
|
||||
$bad[] = $relative;
|
||||
}
|
||||
}
|
||||
assert_same([], $bad);
|
||||
});
|
||||
|
||||
test('backend script protects custom exim config with rollback and exact section insertion checks', function (): void {
|
||||
$script = file_get_contents(PLUGIN_ROOT . '/scripts/backend.sh') ?: '';
|
||||
assert_contains('backup_custom_conf()', $script);
|
||||
assert_contains('restore_custom_conf()', $script);
|
||||
assert_contains("trap 'restore_custom_conf' EXIT", $script);
|
||||
assert_contains('ROLLBACK_REBUILD=1', $script);
|
||||
assert_contains('if ! awk -v section="$section" -v snippet="$snippet"', $script);
|
||||
assert_contains('if (inserted != 1)', $script);
|
||||
test('package source does not ship removed custom mail integration files', function (): void {
|
||||
$removedPaths = [
|
||||
'scripts/' . 'back' . 'end.sh',
|
||||
'scripts/' . 'ex' . 'im',
|
||||
'scripts/global_auto' . 'responder_worker.php',
|
||||
'exec/lib/Back' . 'endRuntimeConfig.php',
|
||||
'exec/lib/Message' . 'Classifier.php',
|
||||
'exec/lib/Mail' . 'Sender.php',
|
||||
'exec/lib/Repeat' . 'State.php',
|
||||
];
|
||||
foreach ($removedPaths as $relative) {
|
||||
$path = PLUGIN_ROOT . '/' . $relative;
|
||||
assert_false(is_file($path) || is_dir($path), $relative . ' must not exist');
|
||||
}
|
||||
});
|
||||
|
||||
test('lifecycle scripts install cron sync and remove exim integration on uninstall', function (): void {
|
||||
test('lifecycle scripts install directadmin sync cron only', function (): void {
|
||||
$install = file_get_contents(PLUGIN_ROOT . '/scripts/install.sh') ?: '';
|
||||
$update = file_get_contents(PLUGIN_ROOT . '/scripts/update.sh') ?: '';
|
||||
$uninstall = file_get_contents(PLUGIN_ROOT . '/scripts/uninstall.sh') ?: '';
|
||||
@@ -55,5 +61,7 @@ test('lifecycle scripts install cron sync and remove exim integration on uninsta
|
||||
assert_contains('sync_directadmin_vacations.php', $install);
|
||||
assert_contains('/etc/cron.d/global-autoresponder', $update);
|
||||
assert_contains('sync_directadmin_vacations.php', $update);
|
||||
assert_contains('backend.sh" da', $uninstall);
|
||||
assert_false(str_contains($install, 'back' . 'end-state.json'));
|
||||
assert_false(str_contains($install, 'state/' . 'replies'));
|
||||
assert_false(str_contains($uninstall, 'back' . 'end.sh'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user