More unittests

This commit is contained in:
2023-11-14 09:09:15 +00:00
parent bedc666f7c
commit cadb207758
7 changed files with 136 additions and 54 deletions

View File

@ -37,14 +37,14 @@ class App
'options' => Expect::arrayOf('string', 'string')
]),
'backup' => Expect::arrayOf(Expect::structure([
'title' => Expect::string(),
'source' => Expect::string(),
'destination' => Expect::string(),
])),
'title' => Expect::string()->required(),
'source' => Expect::string()->required(),
'destination' => Expect::string()->required(),
]))->required(),
'notification' => Expect::arrayOf(Expect::structure([
'type' => Expect::string(),
'domain' => Expect::string(),
'topic' => Expect::string(),
'type' => Expect::string()->required(),
'domain' => Expect::string()->required(),
'topic' => Expect::string()->required(),
])),
'log' => Expect::string()->assert(
function (string $path): bool {
@ -53,17 +53,16 @@ class App
),
'templates' => Expect::structure(
[
'notify' => Expect::string(),
'error' => Expect::string()
'notify' => Expect::string()->required(),
'error' => Expect::string()->required()
]
)
)->required()
]);
$parser = new Yaml();
/** @var array<string, mixed> */
$parsedConfig = $parser->parseFile($configFile);
// Merge those values into the configuration schema:
$this->config->merge($parsedConfig);