feat: complete production backend integration
This commit is contained in:
@@ -7,3 +7,40 @@ test('packing guidelines exclude docs and allow later manual icon', function ():
|
||||
assert_contains('must not contain `docs/`', $packing);
|
||||
assert_contains('may be added later at `src/images/user_icon.svg`', $packing);
|
||||
});
|
||||
|
||||
test('plugin metadata runs user level as root on directadmin 1.689 plus', function (): void {
|
||||
$conf = file_get_contents(PLUGIN_ROOT . '/plugin.conf') ?: '';
|
||||
assert_contains('type=user', $conf);
|
||||
assert_contains('user_run_as=root', $conf);
|
||||
});
|
||||
|
||||
test('shipped plugin files do not contain placeholders', function (): void {
|
||||
$bad = [];
|
||||
$root = new RecursiveDirectoryIterator(PLUGIN_ROOT, FilesystemIterator::SKIP_DOTS);
|
||||
$it = new RecursiveIteratorIterator($root);
|
||||
foreach ($it as $file) {
|
||||
if (!$file->isFile()) {
|
||||
continue;
|
||||
}
|
||||
$path = $file->getPathname();
|
||||
$relative = substr($path, strlen(PLUGIN_ROOT) + 1);
|
||||
if (str_starts_with($relative, '.git/') || str_starts_with($relative, 'tests/')) {
|
||||
continue;
|
||||
}
|
||||
$content = file_get_contents($path) ?: '';
|
||||
if (preg_match('/placeholder|TODO|FIXME|not implemented|pending_exim_validation|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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user