Add own admin page for the plugin
Some checks failed
DokuWiki Default Tasks / all (push) Has been cancelled

This commit is contained in:
2026-01-06 22:39:21 +01:00
parent f86dce6ec3
commit 6a396ce511
16 changed files with 269 additions and 50 deletions

View File

@@ -39,47 +39,43 @@ class GeneralTest extends DokuWikiTest
}
/**
* Test to ensure that every conf['...'] entry in conf/default.php has a corresponding meta['...'] entry in
* conf/metadata.php.
* luxtools settings are managed via the plugin's admin page, not via the Configuration Manager.
* Ensure default config exists and (when present) metadata.php does not expose any settings.
*/
public function testPluginConf(): void
{
$conf_file = __DIR__ . '/../conf/default.php';
$meta_file = __DIR__ . '/../conf/metadata.php';
if (!file_exists($conf_file) && !file_exists($meta_file)) {
self::markTestSkipped('No config files exist -> skipping test');
if (!file_exists($conf_file)) {
self::markTestSkipped('No config default.php exists -> skipping test');
}
if (file_exists($conf_file)) {
include($conf_file);
}
if (file_exists($meta_file)) {
include($meta_file);
}
$conf = null;
$meta = null;
$this->assertEquals(
gettype($conf),
gettype($meta),
'Both ' . DOKU_PLUGIN . 'luxtools/conf/default.php and ' . DOKU_PLUGIN . 'luxtools/conf/metadata.php have to exist and contain the same keys.'
include($conf_file);
$this->assertIsArray(
$conf,
'The ' . DOKU_PLUGIN . 'luxtools/conf/default.php file needs to define $conf as an array.'
);
if ($conf !== null && $meta !== null) {
foreach ($conf as $key => $value) {
$this->assertArrayHasKey(
$key,
$meta,
'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'luxtools/conf/metadata.php'
);
if (file_exists($meta_file)) {
include($meta_file);
if ($meta === null) {
// If the file exists but does not define $meta, treat it as empty.
$meta = [];
}
foreach ($meta as $key => $value) {
$this->assertArrayHasKey(
$key,
$conf,
'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'luxtools/conf/default.php'
);
}
$this->assertIsArray(
$meta,
'The ' . DOKU_PLUGIN . 'luxtools/conf/metadata.php file needs to define $meta as an array.'
);
$this->assertEmpty(
$meta,
'luxtools should not expose settings via the Configuration Manager.'
);
}
}