defaultLanguage()); assert_false($settings->defaultEnable()); assert_same('Europe/Warsaw', $settings->timezone()); assert_same('exact_hour', $settings->scheduleMode()); assert_same('/usr/local/hitme_plugins/global-autoresponders/config', Settings::CONFIG_DIR); assert_same('/usr/local/hitme_plugins/global-autoresponders/data', Settings::DATA_DIR); }); test('settings template does not contain global repeat policy settings', function (): void { $template = file_get_contents(PLUGIN_ROOT . '/plugin-settings.conf') ?: ''; assert_false(str_contains($template, 'GLOBAL_AUTORESPONDER_REPLY_EVERY_MESSAGE')); assert_false(str_contains($template, 'GLOBAL_AUTORESPONDER_REPEAT_MINUTES')); }); test('settings reject invalid timezone and schedule mode', function (): void { $path = TEST_TMP . '/bad-settings.conf'; test_write($path, "GLOBAL_AUTORESPONDER_TIMEZONE=Not/AZone\n"); try { Settings::load($path); } catch (InvalidArgumentException $e) { assert_contains('timezone', $e->getMessage()); return; } throw new RuntimeException('Expected invalid settings to fail'); }); test('settings keep exact schedule mode', function (): void { $settings = Settings::load(TEST_TMP . '/schedule.conf'); assert_same('exact_hour', $settings->scheduleMode()); }); test('directadmin user access follows DEFAULT_ENABLE and per-user overrides', function (): void { $settingsPath = TEST_TMP . '/access.conf'; test_write($settingsPath, "DEFAULT_ENABLE=false\n"); $settings = Settings::load($settingsPath); $user = new DirectAdminUser('marek', 'enhanced', 'en', TEST_TMP . '/config'); assert_false($user->hasPluginAccess($settings)); test_write(TEST_TMP . '/config/users/marek.conf', "enabled=true\n"); assert_true($user->hasPluginAccess($settings)); }); test('directadmin user normalizes evolution skin variants', function (): void { assert_same('evolution', (new DirectAdminUser('marek', 'Evolution', 'en', TEST_TMP . '/config'))->skin()); assert_same('evolution', (new DirectAdminUser('marek', 'evolution-ui', 'en', TEST_TMP . '/config'))->skin()); assert_same('enhanced', (new DirectAdminUser('marek', '', 'en', TEST_TMP . '/config'))->skin()); }); test('directadmin user checks common skin environment variables', function (): void { $source = file_get_contents(PLUGIN_ROOT . '/exec/lib/DirectAdminUser.php') ?: ''; assert_contains('SESSION_SKIN', $source); assert_contains('SESSION_SELECTED_SKIN', $source); assert_contains('DA_SKIN', $source); assert_contains("['skin']", $source); assert_contains('readUserConf', $source); });