refactor(theme): drop dark-green and collapse theme registry to light/dark

Remove the extensible theme catalog (config/themes.php + ThemeConfigGateway)
in favor of a two-entry const on SettingsAppGateway. appThemes() now returns
the list directly — no container lookup, no file include. Drop the
dark-green theme assets, narrow [data-theme^="dark"] selectors to
[data-theme="dark"], and tighten isDarkTheme() to an exact match. Ship an
idempotent migration that corrects any leftover 'dark-green' rows on users
and tenants to safe defaults (light / NULL).

Tenant scoping (default_theme, allow_user_theme) and per-user override stay
intact; only the catalog extensibility and the third theme are removed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 16:15:10 +02:00
parent 4b9ce4bbad
commit 0002c07755
19 changed files with 29 additions and 153 deletions

View File

@@ -14,7 +14,6 @@ final class ConfigContractsTest extends TestCase
'config/assets.php',
'config/routes.php',
'config/modules.php',
'config/themes.php',
'config/config.php.example',
];
foreach ($required as $file) {

View File

@@ -5,17 +5,13 @@ namespace MintyPHP\Tests\Service\Settings;
use MintyPHP\Repository\Settings\SettingRepositoryInterface;
use MintyPHP\Service\Settings\SettingsAppGateway;
use MintyPHP\Service\Settings\SettingsMetadataGateway;
use MintyPHP\Service\Settings\ThemeConfigGateway;
use PHPUnit\Framework\TestCase;
class SettingsAppGatewayTest extends TestCase
{
private function createGateway(SettingRepositoryInterface $settings): SettingsAppGateway
{
$themeConfig = $this->createMock(ThemeConfigGateway::class);
$themeConfig->method('all')->willReturn(['light' => 'Light', 'dark' => 'Dark']);
return new SettingsAppGateway(new SettingsMetadataGateway($settings), $themeConfig);
return new SettingsAppGateway(new SettingsMetadataGateway($settings));
}
public function testGetAppTitleReturnsNullWhenEmpty(): void

View File

@@ -8,7 +8,6 @@ use MintyPHP\Service\Settings\SettingsFrontendTelemetryGateway;
use MintyPHP\Service\Settings\SettingsMetadataGateway;
use MintyPHP\Service\Settings\SettingsSmtpGateway;
use MintyPHP\Service\Settings\SettingsSystemAuditGateway;
use MintyPHP\Service\Settings\ThemeConfigGateway;
use PHPUnit\Framework\TestCase;
final class SettingsGatewayNormalizationTest extends TestCase
@@ -124,9 +123,6 @@ final class SettingsGatewayNormalizationTest extends TestCase
private function newAppGateway(SettingRepositoryInterface $settingRepository): SettingsAppGateway
{
$themeConfig = $this->createMock(ThemeConfigGateway::class);
$themeConfig->method('all')->willReturn(['light' => 'Light', 'dark' => 'Dark']);
return new SettingsAppGateway(new SettingsMetadataGateway($settingRepository), $themeConfig);
return new SettingsAppGateway(new SettingsMetadataGateway($settingRepository));
}
}

View File

@@ -4,7 +4,6 @@ namespace MintyPHP\Tests\Support;
use MintyPHP\App\AppContainer;
use MintyPHP\Service\Settings\SettingCacheService;
use MintyPHP\Service\Settings\ThemeConfigGateway;
use PHPUnit\Framework\TestCase;
/**
@@ -27,10 +26,6 @@ class ThemeResolutionTest extends TestCase
$this->container = new AppContainer();
$themeConfig = $this->createMock(ThemeConfigGateway::class);
$themeConfig->method('all')->willReturn(['light' => 'Light', 'dark' => 'Dark']);
$this->container->set(ThemeConfigGateway::class, fn () => $themeConfig);
$this->setAppSettings([]);
$this->pushAppContainer($this->container);