1
0

refactor(settings): remove global appearance settings — tenant is sole source

Removes the global app_theme, app_theme_user and app_primary_color settings
from the admin/settings area and the underlying service/cache/API/i18n/docs
layers. The tenant columns (tenants.primary_color, default_theme,
allow_user_theme) become the single source of truth for appearance.
Branding helpers are tenant-only and fall back to a hardcoded 'light' theme
with no brand color when no tenant context is available (login, error,
pre-session pages). The APP_THEME env var is removed.

Scope:
- UI: Appearance tab gone from /admin/settings; tenant edit form drops the
  global-fallback color preview.
- Service: SettingsAppGateway no longer exposes setting-backed accessors
  for theme/user-theme/primary-color. Theme catalog utilities (listThemes,
  isAllowedTheme, normalizeTheme, resolveDefaultTheme) stay and are used
  across Tenant / Auth / User flows; resolveDefaultTheme now hardcodes
  'light' with a catalog fallback (no global/env lookup).
- AdminSettingsService: buildPageData, sanitization, audit snapshot, apply
  step and cache payload are all stripped of the three keys. Dead helper
  applyAppPrimaryColor + normalizePrimaryColor removed.
- Cache: SettingCacheService HOT_PATH_KEYS drops the three keys.
- API: /settings (GET/PUT) and /settings/public (GET) no longer expose
  appearance fields; OpenAPI schemas pruned accordingly.
- Audit redaction list shortened.
- DB: db/init/init.sql seed rows removed. No migration for existing
  installs — legacy rows stay inert.
- i18n + docs: setting.app_theme, setting.app_theme_user,
  setting.app_primary_color removed from de+en locales; reference and
  explanation docs updated.
- Tests: covering tests for the removed methods pruned; ThemeResolutionTest
  rewritten for tenant-only semantics. One unrelated PHP-CS-Fixer issue in
  UserRegistrar.php cleaned up to keep QG-006 green.

Workflow: .agents/runs/SETTINGS-APPEARANCE-TENANT-ONLY/ (gitignored).
Gates: QG-001..003, QG-006, QG-008 all pass (1985 tests, 28764 assertions).
Reviews: code, security, acceptance all pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 22:40:15 +02:00
parent 3c6ce0cbdb
commit 149d4515de
34 changed files with 164 additions and 551 deletions

View File

@@ -52,16 +52,14 @@ final class AuthSettingsGatewayTest extends TestCase
$this->assertSame(30, $gateway->getApiTokenDefaultTtlDays());
}
public function testAppThemeAccessorsDelegate(): void
public function testThemeHelpersDelegate(): void
{
$app = $this->createMock(SettingsAppGateway::class);
$app->method('getAppTheme')->willReturn('dark');
$app->method('resolveDefaultTheme')->willReturn('light');
$app->expects($this->once())->method('normalizeTheme')->with('DARK')->willReturn('dark');
$gateway = $this->makeGateway(app: $app);
$this->assertSame('dark', $gateway->getAppTheme());
$this->assertSame('light', $gateway->defaultTheme());
$this->assertSame('dark', $gateway->normalizeTheme('DARK'));
}

View File

@@ -437,8 +437,7 @@ class SsoUserLinkServiceTest extends TestCase
$settingsGateway = $this->createMock(AuthSettingsGateway::class);
$settingsGateway->method('getDefaultRoleId')->willReturn(5);
$settingsGateway->method('getDefaultDepartmentId')->willReturn(3);
$settingsGateway->method('getAppTheme')->willReturn('auto');
$settingsGateway->expects($this->any())->method('normalizeTheme')->with('auto')->willReturn('auto');
$settingsGateway->expects($this->any())->method('normalizeTheme')->willReturn('light');
$tenantSsoService = $this->createMock(TenantSsoService::class);
$tenantSsoService->method('microsoftProviderKey')->willReturn('microsoft');
@@ -483,7 +482,6 @@ class SsoUserLinkServiceTest extends TestCase
$settingsGateway = $this->createMock(AuthSettingsGateway::class);
$settingsGateway->method('getDefaultRoleId')->willReturn(0);
$settingsGateway->method('getDefaultDepartmentId')->willReturn(0);
$settingsGateway->method('getAppTheme')->willReturn('light');
$settingsGateway->method('normalizeTheme')->willReturn('light');
$tenantSsoService = $this->createMock(TenantSsoService::class);
@@ -533,7 +531,6 @@ class SsoUserLinkServiceTest extends TestCase
$settingsGateway = $this->createMock(AuthSettingsGateway::class);
$settingsGateway->method('getDefaultRoleId')->willReturn(0);
$settingsGateway->method('getDefaultDepartmentId')->willReturn(0);
$settingsGateway->method('getAppTheme')->willReturn('auto');
$settingsGateway->method('normalizeTheme')->willReturn('auto');
$tenantSsoService = $this->createMock(TenantSsoService::class);
@@ -580,7 +577,6 @@ class SsoUserLinkServiceTest extends TestCase
$settingsGateway = $this->createMock(AuthSettingsGateway::class);
$settingsGateway->method('getDefaultRoleId')->willReturn(0);
$settingsGateway->method('getDefaultDepartmentId')->willReturn(0);
$settingsGateway->method('getAppTheme')->willReturn('auto');
$settingsGateway->method('normalizeTheme')->willReturn('auto');
$tenantSsoService = $this->createMock(TenantSsoService::class);
@@ -617,7 +613,6 @@ class SsoUserLinkServiceTest extends TestCase
$userWriteRepo->method('create')->willReturn(false);
$settingsGateway = $this->createMock(AuthSettingsGateway::class);
$settingsGateway->method('getAppTheme')->willReturn('auto');
$settingsGateway->method('normalizeTheme')->willReturn('auto');
$tenantSsoService = $this->createMock(TenantSsoService::class);
@@ -650,7 +645,6 @@ class SsoUserLinkServiceTest extends TestCase
$userWriteRepo->method('create')->willReturn(0);
$settingsGateway = $this->createMock(AuthSettingsGateway::class);
$settingsGateway->method('getAppTheme')->willReturn('auto');
$settingsGateway->method('normalizeTheme')->willReturn('auto');
$tenantSsoService = $this->createMock(TenantSsoService::class);
@@ -903,7 +897,6 @@ class SsoUserLinkServiceTest extends TestCase
$settingsGateway = $this->createMock(AuthSettingsGateway::class);
$settingsGateway->method('getDefaultRoleId')->willReturn(0);
$settingsGateway->method('getDefaultDepartmentId')->willReturn(0);
$settingsGateway->method('getAppTheme')->willReturn('light');
$settingsGateway->method('normalizeTheme')->willReturn('light');
$tenantSsoService = $this->createMock(TenantSsoService::class);

View File

@@ -313,8 +313,6 @@ class AdminSettingsServiceApiLifecycleTest extends TestCase
'default_department_id' => '0',
'app_title' => 'Demo',
'app_locale' => 'de',
'app_theme' => 'light',
'app_theme_user' => '1',
'app_registration' => '1',
'api_token_default_ttl_days' => '90',
'api_token_max_ttl_days' => '365',
@@ -328,7 +326,6 @@ class AdminSettingsServiceApiLifecycleTest extends TestCase
'frontend_telemetry_enabled' => '1',
'frontend_telemetry_sample_rate' => '0.2',
'frontend_telemetry_allowed_events' => ['warn_once'],
'app_primary_color' => '#2FA4A4',
'smtp_host' => '',
'smtp_port' => '',
'smtp_user' => '',
@@ -359,16 +356,10 @@ class AdminSettingsServiceApiLifecycleTest extends TestCase
$settingsAppGateway = $this->createConfiguredMock(SettingsAppGateway::class, [
'getAppLocale' => 'de',
'getAppTheme' => 'light',
'isUserThemeAllowed' => true,
'isRegistrationEnabled' => true,
'getAppPrimaryColor' => '#2FA4A4',
'setAppTitle' => true,
'setAppLocale' => true,
'setAppTheme' => true,
'setUserThemeAllowed' => true,
'setRegistrationEnabled' => true,
'setAppPrimaryColor' => true,
]);
$settingsApiPolicyGateway = $settingsApiPolicyGateway ?? $this->createConfiguredMock(SettingsApiPolicyGateway::class, [

View File

@@ -25,62 +25,6 @@ use PHPUnit\Framework\TestCase;
class AdminSettingsServiceAppTest extends TestCase
{
// ---------------------------------------------------------------
// Primary color
// ---------------------------------------------------------------
public function testUpdateFromAdminPersistsValidPrimaryColor(): void
{
$appGateway = $this->createMock(SettingsAppGateway::class);
$appGateway->method('getAppLocale')->willReturn('de');
$appGateway->method('getAppTheme')->willReturn('light');
$appGateway->method('isUserThemeAllowed')->willReturn(true);
$appGateway->method('isRegistrationEnabled')->willReturn(true);
$appGateway->method('getAppPrimaryColor')->willReturn('#2FA4A4');
$appGateway->method('setAppTitle')->willReturn(true);
$appGateway->method('setAppLocale')->willReturn(true);
$appGateway->method('setAppTheme')->willReturn(true);
$appGateway->method('setUserThemeAllowed')->willReturn(true);
$appGateway->method('setRegistrationEnabled')->willReturn(true);
$appGateway->expects($this->once())
->method('setAppPrimaryColor')
->with('#2FA4A4')
->willReturn(true);
$service = $this->newService(settingsAppGateway: $appGateway);
$result = $service->updateFromAdmin($this->validPostData([
'app_primary_color' => '#2FA4A4',
]));
$this->assertSame([], $result['errors'] ?? []);
}
public function testUpdateFromAdminReturnsErrorForInvalidPrimaryColor(): void
{
$appGateway = $this->createMock(SettingsAppGateway::class);
$appGateway->method('getAppLocale')->willReturn('de');
$appGateway->method('getAppTheme')->willReturn('light');
$appGateway->method('isUserThemeAllowed')->willReturn(true);
$appGateway->method('isRegistrationEnabled')->willReturn(true);
$appGateway->method('getAppPrimaryColor')->willReturn('#2FA4A4');
$appGateway->method('setAppTitle')->willReturn(true);
$appGateway->method('setAppLocale')->willReturn(true);
$appGateway->method('setAppTheme')->willReturn(true);
$appGateway->method('setUserThemeAllowed')->willReturn(true);
$appGateway->method('setRegistrationEnabled')->willReturn(true);
$appGateway->expects($this->once())
->method('setAppPrimaryColor')
->with('not-a-color')
->willReturn(false);
$service = $this->newService(settingsAppGateway: $appGateway);
$result = $service->updateFromAdmin($this->validPostData([
'app_primary_color' => 'not-a-color',
]));
$this->assertContains('app_primary_invalid', $this->extractErrorKeys($result));
}
// ---------------------------------------------------------------
// buildPageData: sorted tenants/roles/departments
// ---------------------------------------------------------------
@@ -165,10 +109,7 @@ class AdminSettingsServiceAppTest extends TestCase
'default_department_id',
'app_title',
'app_locale',
'app_theme',
'app_theme_user',
'app_registration',
'app_primary_color',
'api_token_default_ttl_days',
'api_token_max_ttl_days',
'user_inactivity_deactivate_days',
@@ -248,19 +189,6 @@ class AdminSettingsServiceAppTest extends TestCase
// Helpers
// ---------------------------------------------------------------
/** @return list<string> */
private function extractErrorKeys(array $result): array
{
$errors = is_array($result['errors'] ?? null) ? $result['errors'] : [];
$errorKeys = [];
foreach ($errors as $error) {
if (is_array($error) && isset($error['key'])) {
$errorKeys[] = (string) $error['key'];
}
}
return $errorKeys;
}
/**
* @param array<string, mixed> $overrides
* @return array<string, mixed>
@@ -273,8 +201,6 @@ class AdminSettingsServiceAppTest extends TestCase
'default_department_id' => '0',
'app_title' => 'Demo',
'app_locale' => 'de',
'app_theme' => 'light',
'app_theme_user' => '1',
'app_registration' => '1',
'api_token_default_ttl_days' => '90',
'api_token_max_ttl_days' => '365',
@@ -288,7 +214,6 @@ class AdminSettingsServiceAppTest extends TestCase
'frontend_telemetry_enabled' => '1',
'frontend_telemetry_sample_rate' => '0.2',
'frontend_telemetry_allowed_events' => ['warn_once'],
'app_primary_color' => '#2FA4A4',
'smtp_host' => '',
'smtp_port' => '',
'smtp_user' => '',
@@ -324,16 +249,10 @@ class AdminSettingsServiceAppTest extends TestCase
$settingsAppGateway = $settingsAppGateway ?? $this->createConfiguredMock(SettingsAppGateway::class, [
'getAppLocale' => 'de',
'getAppTheme' => 'light',
'isUserThemeAllowed' => true,
'isRegistrationEnabled' => true,
'getAppPrimaryColor' => '#2FA4A4',
'setAppTitle' => true,
'setAppLocale' => true,
'setAppTheme' => true,
'setUserThemeAllowed' => true,
'setRegistrationEnabled' => true,
'setAppPrimaryColor' => true,
]);
$settingsApiPolicyGateway = $this->createConfiguredMock(SettingsApiPolicyGateway::class, [

View File

@@ -396,8 +396,6 @@ class AdminSettingsServiceSecurityTest extends TestCase
'default_department_id' => '0',
'app_title' => 'Demo',
'app_locale' => 'de',
'app_theme' => 'light',
'app_theme_user' => '1',
'app_registration' => '1',
'api_token_default_ttl_days' => '90',
'api_token_max_ttl_days' => '365',
@@ -411,7 +409,6 @@ class AdminSettingsServiceSecurityTest extends TestCase
'frontend_telemetry_enabled' => '1',
'frontend_telemetry_sample_rate' => '0.2',
'frontend_telemetry_allowed_events' => ['warn_once'],
'app_primary_color' => '#2FA4A4',
'smtp_host' => '',
'smtp_port' => '',
'smtp_user' => '',
@@ -443,16 +440,10 @@ class AdminSettingsServiceSecurityTest extends TestCase
$settingsAppGateway = $this->createConfiguredMock(SettingsAppGateway::class, [
'getAppLocale' => 'de',
'getAppTheme' => 'light',
'isUserThemeAllowed' => true,
'isRegistrationEnabled' => true,
'getAppPrimaryColor' => '#2FA4A4',
'setAppTitle' => true,
'setAppLocale' => true,
'setAppTheme' => true,
'setUserThemeAllowed' => true,
'setRegistrationEnabled' => true,
'setAppPrimaryColor' => true,
]);
$settingsApiPolicyGateway = $this->createConfiguredMock(SettingsApiPolicyGateway::class, [

View File

@@ -193,8 +193,6 @@ class AdminSettingsServiceSessionPolicyTest extends TestCase
'default_department_id' => '0',
'app_title' => 'Demo',
'app_locale' => 'de',
'app_theme' => 'light',
'app_theme_user' => '1',
'app_registration' => '1',
'api_token_default_ttl_days' => '90',
'api_token_max_ttl_days' => '365',
@@ -208,7 +206,6 @@ class AdminSettingsServiceSessionPolicyTest extends TestCase
'frontend_telemetry_enabled' => '1',
'frontend_telemetry_sample_rate' => '0.2',
'frontend_telemetry_allowed_events' => ['warn_once'],
'app_primary_color' => '#2FA4A4',
'smtp_host' => '',
'smtp_port' => '',
'smtp_user' => '',
@@ -240,16 +237,10 @@ class AdminSettingsServiceSessionPolicyTest extends TestCase
$settingsAppGateway = $this->createConfiguredMock(SettingsAppGateway::class, [
'getAppLocale' => 'de',
'getAppTheme' => 'light',
'isUserThemeAllowed' => true,
'isRegistrationEnabled' => true,
'getAppPrimaryColor' => '#2FA4A4',
'setAppTitle' => true,
'setAppLocale' => true,
'setAppTheme' => true,
'setUserThemeAllowed' => true,
'setRegistrationEnabled' => true,
'setAppPrimaryColor' => true,
]);
$settingsApiPolicyGateway = $this->createConfiguredMock(SettingsApiPolicyGateway::class, [

View File

@@ -45,16 +45,13 @@ class SettingCacheServiceTest extends TestCase
$file = $this->tempFilePath();
$metadataGateway = $this->createMock(SettingsMetadataGateway::class);
$metadataGateway->expects($this->exactly(6))
$metadataGateway->expects($this->exactly(3))
->method('getValue')
->willReturnCallback(static function (string $key): ?string {
return match ($key) {
SettingKeys::APP_TITLE_KEY => 'Demo App',
SettingKeys::APP_LOCALE_KEY => 'de',
SettingKeys::APP_THEME_KEY => 'dark',
SettingKeys::APP_THEME_USER_KEY => '1',
SettingKeys::APP_REGISTRATION_KEY => '0',
SettingKeys::APP_PRIMARY_COLOR_KEY => '#112233',
default => null,
};
});
@@ -66,7 +63,7 @@ class SettingCacheServiceTest extends TestCase
/** @var array<string, string> $cache */
$cache = include $file;
$this->assertSame('de', $cache[SettingKeys::APP_LOCALE_KEY] ?? null);
$this->assertSame('#112233', $cache[SettingKeys::APP_PRIMARY_COLOR_KEY] ?? null);
$this->assertSame('0', $cache[SettingKeys::APP_REGISTRATION_KEY] ?? null);
}
private function tempFilePath(): string

View File

@@ -10,19 +10,12 @@ use PHPUnit\Framework\TestCase;
class SettingsAppGatewayTest extends TestCase
{
private function createGateway(SettingRepositoryInterface $settings, ?ThemeConfigGateway $themeConfig = null): SettingsAppGateway
{
$themeConfig ??= $this->createDefaultThemeConfig();
return new SettingsAppGateway(new SettingsMetadataGateway($settings), $themeConfig);
}
private function createDefaultThemeConfig(): ThemeConfigGateway
private function createGateway(SettingRepositoryInterface $settings): SettingsAppGateway
{
$themeConfig = $this->createMock(ThemeConfigGateway::class);
$themeConfig->method('all')->willReturn(['light' => 'Light', 'dark' => 'Dark']);
return $themeConfig;
return new SettingsAppGateway(new SettingsMetadataGateway($settings), $themeConfig);
}
public function testGetAppTitleReturnsNullWhenEmpty(): void
@@ -69,38 +62,4 @@ class SettingsAppGatewayTest extends TestCase
$gateway = $this->createGateway($settings);
$this->assertFalse($gateway->isRegistrationEnabled());
}
public function testGetAppPrimaryColorRejectsInvalidFormat(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$settings->expects($this->any())->method('getValue')->with('app_primary_color')->willReturn('not-a-color');
$gateway = $this->createGateway($settings);
$this->assertNull($gateway->getAppPrimaryColor());
}
public function testGetAppPrimaryColorReturnsValidHex(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$settings->expects($this->any())->method('getValue')->with('app_primary_color')->willReturn('#ff5500');
$gateway = $this->createGateway($settings);
$this->assertSame('#ff5500', $gateway->getAppPrimaryColor());
}
public function testIsAllowedThemeReturnsTrueForKnownTheme(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$gateway = $this->createGateway($settings);
$this->assertTrue($gateway->isAllowedTheme('dark'));
}
public function testIsAllowedThemeReturnsFalseForUnknownTheme(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$gateway = $this->createGateway($settings);
$this->assertFalse($gateway->isAllowedTheme('neon'));
}
}

View File

@@ -25,52 +25,17 @@ final class SettingsGatewayNormalizationTest extends TestCase
self::assertTrue($gateway->setAppLocale(' '));
}
public function testAppThemeStoresNullForUnknownTheme(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$settings->expects($this->once())
->method('set')
->with('app_theme', null, 'setting.app_theme')
->willReturn(true);
$gateway = $this->newAppGateway($settings);
self::assertTrue($gateway->setAppTheme('unknown'));
}
public function testAppBooleanFlagsUseExpectedDefaults(): void
public function testAppRegistrationDefaultIsTrueWhenUnset(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$settings->method('getValue')->willReturnMap([
['app_theme_user', null],
['app_registration', null],
]);
$gateway = $this->newAppGateway($settings);
self::assertTrue($gateway->isUserThemeAllowed());
self::assertTrue($gateway->isRegistrationEnabled());
}
public function testAppPrimaryColorNormalizesHexWithoutHash(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$settings->expects($this->once())
->method('set')
->with('app_primary_color', '#abc', 'setting.app_primary_color')
->willReturn(true);
$gateway = $this->newAppGateway($settings);
self::assertTrue($gateway->setAppPrimaryColor('abc'));
}
public function testAppPrimaryColorRejectsInvalidValue(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$settings->expects($this->never())->method('set');
$gateway = $this->newAppGateway($settings);
self::assertFalse($gateway->setAppPrimaryColor('not-a-color'));
}
public function testSystemAuditUsesFallbacksAndRejectsOutOfRangeRetention(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
@@ -159,9 +124,9 @@ final class SettingsGatewayNormalizationTest extends TestCase
private function newAppGateway(SettingRepositoryInterface $settingRepository): SettingsAppGateway
{
$themeConfigService = $this->createMock(ThemeConfigGateway::class);
$themeConfigService->method('all')->willReturn(['light' => 'Light', 'dark' => 'Dark']);
$themeConfig = $this->createMock(ThemeConfigGateway::class);
$themeConfig->method('all')->willReturn(['light' => 'Light', 'dark' => 'Dark']);
return new SettingsAppGateway(new SettingsMetadataGateway($settingRepository), $themeConfigService);
return new SettingsAppGateway(new SettingsMetadataGateway($settingRepository), $themeConfig);
}
}

View File

@@ -315,7 +315,6 @@ class UserAccountServiceTest extends TestCase
$passwordService->method('validatePassword')->willReturn([]);
$settingsGateway = $this->createMock(UserSettingsGateway::class);
$settingsGateway->method('getAppTheme')->willReturn('dark');
$settingsGateway->method('getDefaultTenantId')->willReturn(3);
$settingsGateway->method('getDefaultRoleId')->willReturn(4);
$settingsGateway->method('getDefaultDepartmentId')->willReturn(5);
@@ -326,8 +325,11 @@ class UserAccountServiceTest extends TestCase
$writeRepository->expects($this->once())
->method('create')
->with($this->callback(static function (array $data): bool {
// New users created via register() get the default 'light' theme.
// Appearance is tenant-scoped, not globally configurable, so
// normalizeTheme(null) resolves to 'light'.
return (string) ($data['email'] ?? '') === 'user@example.com'
&& (string) ($data['theme'] ?? '') === 'dark'
&& (string) ($data['theme'] ?? '') === 'light'
&& (int) ($data['primary_tenant_id'] ?? 0) === 3
&& (int) ($data['active'] ?? 0) === 1;
}))
@@ -376,7 +378,6 @@ class UserAccountServiceTest extends TestCase
$settingsGateway->method('getDefaultTenantId')->willReturn(null);
$settingsGateway->method('getDefaultRoleId')->willReturn(null);
$settingsGateway->method('getDefaultDepartmentId')->willReturn(null);
$settingsGateway->method('getAppTheme')->willReturn('light');
$settingsGateway->method('normalizeTheme')
->willReturnCallback(static fn (?string $theme): string => $theme ?? 'light');
@@ -439,7 +440,6 @@ class UserAccountServiceTest extends TestCase
$passwordService->method('validatePassword')->willReturn([]);
$settingsGateway = $this->createMock(UserSettingsGateway::class);
$settingsGateway->method('getAppTheme')->willReturn('dark');
$settingsGateway->method('getDefaultTenantId')->willReturn(3);
$settingsGateway->method('getDefaultRoleId')->willReturn(4);
$settingsGateway->method('getDefaultDepartmentId')->willReturn(5);
@@ -659,7 +659,6 @@ class UserAccountServiceTest extends TestCase
$settingsGateway->method('getDefaultTenantId')->willReturn(null);
$settingsGateway->method('getDefaultRoleId')->willReturn(null);
$settingsGateway->method('getDefaultDepartmentId')->willReturn(null);
$settingsGateway->method('getAppTheme')->willReturn('light');
}
if ($scopeGateway === null) {

View File

@@ -55,24 +55,6 @@ class UserSettingsGatewayTest extends TestCase
$this->assertSame(8, $gateway->getDefaultDepartmentId());
}
public function testGetAppThemeDelegates(): void
{
$app = $this->createMock(SettingsAppGateway::class);
$app->method('getAppTheme')->willReturn('dark');
$gateway = new UserSettingsGateway($this->createMock(SettingsDefaultsGateway::class), $app, $this->createMock(SettingsUserLifecycleGateway::class));
$this->assertSame('dark', $gateway->getAppTheme());
}
public function testGetAppThemeReturnsNullWhenUnset(): void
{
$app = $this->createMock(SettingsAppGateway::class);
$app->method('getAppTheme')->willReturn(null);
$gateway = new UserSettingsGateway($this->createMock(SettingsDefaultsGateway::class), $app, $this->createMock(SettingsUserLifecycleGateway::class));
$this->assertNull($gateway->getAppTheme());
}
public function testAppThemesDelegatesToListThemes(): void
{
$themes = ['light' => 'Light', 'dark' => 'Dark'];