SiteWeaver_CMS/tests/unit/Core/ConfigTest.php
Funky Waddle 059d3d2f12
Some checks are pending
CI / build_and_test (push) Waiting to run
Milestones 0-1
2026-09-10 14:14:52 -05:00

41 lines
918 B
PHP

<?php
declare(strict_types=1);
namespace Tests\unit\Core;
use SiteWeaver\Core\Config;
use PHPUnit\Framework\TestCase;
final class ConfigTest extends TestCase
{
public function testLoadsEnvironmentVariables(): void
{
$env = [
'APP_ENV' => 'testing',
'DB_HOST' => 'localhost',
'DEBUG' => true,
];
$config = new Config($env);
$this->assertSame('testing', $config->get('APP_ENV'));
$this->assertSame('localhost', $config->get('DB_HOST'));
$this->assertTrue($config->get('DEBUG'));
// unknown key returns null
$this->assertNull($config->get('NON_EXISTENT_KEY'));
}
public function testAllReturnsMergedArray(): void
{
$env = [
'FOO' => 'bar',
'BAZ' => 123,
];
$config = new Config($env);
$this->assertSame($env, $config->all());
}
}