24 lines
865 B
PHP
24 lines
865 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Utils\SecurityConfig;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class ProductionSecurityConfigTest extends TestCase
|
|
{
|
|
public function testDevelopmentDefaultsKeepLocalhostCorsAndDebugLogging(): void
|
|
{
|
|
$this->assertSame('http://localhost:8080', SecurityConfig::resolveCorsOrigin('development'));
|
|
$this->assertSame(100, SecurityConfig::resolveRateLimit('development', 100));
|
|
$this->assertSame(100, SecurityConfig::resolveLogLevel('debug'));
|
|
}
|
|
|
|
public function testProductionDefaultsRejectWildcardOriginsAndUseRestrictedLogging(): void
|
|
{
|
|
$this->assertSame('', SecurityConfig::resolveCorsOrigin('production'));
|
|
$this->assertSame(120, SecurityConfig::resolveRateLimit('production', 120));
|
|
$this->assertSame(300, SecurityConfig::resolveLogLevel('warning'));
|
|
}
|
|
}
|