1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-31 22:00:23 +02:00

test: add new test for Configuration (#2915)

This commit is contained in:
Dag
2022-07-10 20:05:27 +02:00
committed by GitHub
parent c33f84fcc2
commit 5e52ecc3f8
4 changed files with 37 additions and 4 deletions

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace RssBridge\Tests;
use Configuration;
use PHPUnit\Framework\TestCase;
final class ConfigurationTest extends TestCase
{
public function test()
{
putenv('RSSBRIDGE_system_timezone=Europe/Berlin');
Configuration::loadConfiguration();
// test nonsense
$this->assertSame(null, Configuration::getConfig('foobar', ''));
$this->assertSame(null, Configuration::getConfig('foo', 'bar'));
$this->assertSame(null, Configuration::getConfig('cache', ''));
// test value from env
$this->assertSame('Europe/Berlin', Configuration::getConfig('system', 'timezone'));
// test real values
$this->assertSame('file', Configuration::getConfig('cache', 'type'));
$this->assertSame(false, Configuration::getConfig('authentication', 'enable'));
$this->assertSame(true, Configuration::getConfig('admin', 'donations'));
$this->assertSame(1, Configuration::getConfig('error', 'report_limit'));
}
}