From da100b85f5c737b211937116f85b324a8463bc69 Mon Sep 17 00:00:00 2001 From: Norbert Wagner Date: Thu, 7 Jan 2021 15:32:41 +0100 Subject: [PATCH] write some more tests --- tests/SettingsTest.php | 21 +++++++++++++++++++++ tests/config/VeruA.default.conf.php | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 tests/config/VeruA.default.conf.php diff --git a/tests/SettingsTest.php b/tests/SettingsTest.php index 1ee2e57..3a24b5a 100644 --- a/tests/SettingsTest.php +++ b/tests/SettingsTest.php @@ -27,6 +27,27 @@ use PHPUnit\Framework\TestCase; class SettingsTest extends TestCase { + public function testLoadNoFile() + { + $this->expectException(\ErrorException::class); + (new Settings())->load(); + } + + public function testLoad() + { + $cfg = (new Settings())->appPath(dirname(__FILE__).'/')->load(); + $this->assertNotEmpty($cfg); + return $cfg; + } + + /** + * @depends testLoad + */ + public function testMode(Settings $cfg) + { + $this->assertEquals('test', $cfg->mode); + } + public function testBuildFileName() { $path = './config/'; diff --git a/tests/config/VeruA.default.conf.php b/tests/config/VeruA.default.conf.php new file mode 100644 index 0000000..ded4c06 --- /dev/null +++ b/tests/config/VeruA.default.conf.php @@ -0,0 +1,3 @@ + 'test' +];