Consolidate settings normalization tests
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user