move_detect/cloud/tests/ConfigTest.php

24 lines
767 B
PHP

<?php
declare(strict_types=1);
namespace App\Tests;
use App\Config;
use PHPUnit\Framework\TestCase;
final class ConfigTest extends TestCase
{
public function testTypedGettersWithDefaults(): void
{
$c = Config::fromArray(['db_dsn' => 'sqlite::memory:']);
$this->assertSame('sqlite::memory:', $c->dbDsn());
$this->assertSame(300, $c->timestampWindow());
$this->assertSame(60, $c->rateLimitPerMin());
$this->assertSame(86400, $c->nonceTtl());
}
public function testOverrides(): void
{
$c = Config::fromArray(['db_dsn' => 'x', 'timestamp_window' => 120, 'rate_limit_per_min' => 30]);
$this->assertSame(120, $c->timestampWindow());
$this->assertSame(30, $c->rateLimitPerMin());
}
}