forked from fa/breadcrumb-the-shire
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>
62 lines
2.3 KiB
PHP
62 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Tests\Service\Settings;
|
|
|
|
use MintyPHP\Repository\Settings\SettingRepositoryInterface;
|
|
use MintyPHP\Service\Settings\SettingsAppGateway;
|
|
use MintyPHP\Service\Settings\SettingsMetadataGateway;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class SettingsAppGatewayTest extends TestCase
|
|
{
|
|
private function createGateway(SettingRepositoryInterface $settings): SettingsAppGateway
|
|
{
|
|
return new SettingsAppGateway(new SettingsMetadataGateway($settings));
|
|
}
|
|
|
|
public function testGetAppTitleReturnsNullWhenEmpty(): void
|
|
{
|
|
$settings = $this->createMock(SettingRepositoryInterface::class);
|
|
$settings->expects($this->any())->method('getValue')->with('app_title')->willReturn(null);
|
|
|
|
$gateway = $this->createGateway($settings);
|
|
$this->assertNull($gateway->getAppTitle());
|
|
}
|
|
|
|
public function testGetAppTitleReturnsTrimmedValue(): void
|
|
{
|
|
$settings = $this->createMock(SettingRepositoryInterface::class);
|
|
$settings->expects($this->any())->method('getValue')->with('app_title')->willReturn(' My App ');
|
|
|
|
$gateway = $this->createGateway($settings);
|
|
$this->assertSame('My App', $gateway->getAppTitle());
|
|
}
|
|
|
|
public function testGetAppLocaleReturnsNullWhenNotSet(): void
|
|
{
|
|
$settings = $this->createMock(SettingRepositoryInterface::class);
|
|
$settings->expects($this->any())->method('getValue')->with('app_locale')->willReturn(null);
|
|
|
|
$gateway = $this->createGateway($settings);
|
|
$this->assertNull($gateway->getAppLocale());
|
|
}
|
|
|
|
public function testIsRegistrationEnabledDefaultsToTrue(): void
|
|
{
|
|
$settings = $this->createMock(SettingRepositoryInterface::class);
|
|
$settings->expects($this->any())->method('getValue')->with('app_registration')->willReturn(null);
|
|
|
|
$gateway = $this->createGateway($settings);
|
|
$this->assertTrue($gateway->isRegistrationEnabled());
|
|
}
|
|
|
|
public function testIsRegistrationEnabledReturnsFalseWhenDisabled(): void
|
|
{
|
|
$settings = $this->createMock(SettingRepositoryInterface::class);
|
|
$settings->expects($this->any())->method('getValue')->with('app_registration')->willReturn('0');
|
|
|
|
$gateway = $this->createGateway($settings);
|
|
$this->assertFalse($gateway->isRegistrationEnabled());
|
|
}
|
|
}
|