make default configurations more general and adjust tests accordingly

This commit is contained in:
Norbert Wagner 2021-01-07 17:41:37 +01:00
parent da100b85f5
commit b08be903d2
3 changed files with 8 additions and 8 deletions

View File

@ -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))

View File

@ -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:
}}}*/