From b08be903d2dffd05bc3a99406dd20b992236383b Mon Sep 17 00:00:00 2001 From: Norbert Wagner Date: Thu, 7 Jan 2021 17:41:37 +0100 Subject: [PATCH] make default configurations more general and adjust tests accordingly --- src/Settings.php | 10 +++++----- tests/SettingsTest.php | 6 +++--- .../{VeruA.default.conf.php => default.conf.php} | 0 3 files changed, 8 insertions(+), 8 deletions(-) rename tests/config/{VeruA.default.conf.php => default.conf.php} (100%) diff --git a/src/Settings.php b/src/Settings.php index eb1aeb5..9ede0c7 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -33,11 +33,11 @@ class Settings implements \Iterator private array $settings = []; private string $appPath = './'; - private ?string $pkgPath = null; - private ?string $site = null; + private string $pkgPath = './'; + private string $site; protected string $confDir = 'config/'; - protected string $filePrefix = 'VeruA.'; + protected string $filePrefix = ''; protected string $filePostfix = 'conf.php'; protected array $modes = [ 'prod' => 'default', @@ -67,8 +67,8 @@ class Settings implements \Iterator *///}}} public function appPath( string $path ) { + if ($this->pkgPath === $this->appPath) $this->pkgPath = $path; $this->appPath = $path; - if (! isset( $this->pkgPath )) $this->pkgPath = $path; return $this; }// }}} @@ -146,7 +146,7 @@ class Settings implements \Iterator $localConf = false; if (file_exists($conf)) $localConf = require($conf); - if ( $this->site ) + if ( isset($this->site) ) { $siteConf = $this->buildFileName(self::SITE); if (file_exists($siteConf)) diff --git a/tests/SettingsTest.php b/tests/SettingsTest.php index 3a24b5a..00cbb64 100644 --- a/tests/SettingsTest.php +++ b/tests/SettingsTest.php @@ -51,10 +51,10 @@ class SettingsTest extends TestCase public function testBuildFileName() { $path = './config/'; - $prefix = 'VeruA'; + $prefix = ''; $postfix = 'conf.php'; $type = ''; - $defaultName = "$path$prefix.$type$postfix"; + $defaultName = "$path$prefix$type$postfix"; $cfg = new Settings(); @@ -63,5 +63,5 @@ class SettingsTest extends TestCase } /* jEdit buffer local properties {{{ - * :folding=explicit:collapseFolds=1: + * :folding=explicit:collapseFolds=1: }}}*/ \ No newline at end of file diff --git a/tests/config/VeruA.default.conf.php b/tests/config/default.conf.php similarity index 100% rename from tests/config/VeruA.default.conf.php rename to tests/config/default.conf.php