Consolidate settings normalization tests

This commit is contained in:
2026-03-19 19:43:55 +01:00
parent 83aadb3535
commit bc72fa50a6
14 changed files with 424 additions and 320 deletions

View File

@@ -1,38 +0,0 @@
<?php
namespace MintyPHP\Tests\Service\Settings;
use MintyPHP\Repository\Settings\SettingRepositoryInterface;
use MintyPHP\Service\Settings\SettingsMetadataGateway;
use MintyPHP\Service\Settings\SettingsSystemAuditGateway;
use PHPUnit\Framework\TestCase;
class SettingsSystemAuditGatewayTest extends TestCase
{
public function testIsSystemAuditEnabledUsesFallbackWhenMissing(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$settings->method('getValue')->willReturn(null);
$gateway = new SettingsSystemAuditGateway(new SettingsMetadataGateway($settings));
$this->assertTrue($gateway->isSystemAuditEnabled());
}
public function testRetentionFallsBackWhenOutOfRange(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$settings->method('getValue')->willReturn('5');
$gateway = new SettingsSystemAuditGateway(new SettingsMetadataGateway($settings));
$this->assertSame(365, $gateway->getSystemAuditRetentionDays());
}
public function testSetSystemAuditRetentionRejectsOutOfRange(): void
{
$settings = $this->createMock(SettingRepositoryInterface::class);
$settings->expects($this->never())->method('set');
$gateway = new SettingsSystemAuditGateway(new SettingsMetadataGateway($settings));
$this->assertFalse($gateway->setSystemAuditRetentionDays(10));
}
}