rss-bridge/tests/ConfigurationTest.php
Dag ecb486794b
refactor: use static values for cache scope
This fixes a future problem when code is placed under a namespace because `get_class($bridge)` will then return e.g. `RssBridge\Bridge\TwitterBridge` instead of the the current value `TwitterBridge`.

Also a bit refactoring of `Configuration.php`.
2022-08-02 15:03:54 +02:00

25 lines
674 B
PHP

<?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'));
}
}