assertFileExists($file); $info = confToHash($file); $this->assertArrayHasKey('base', $info); $this->assertArrayHasKey('author', $info); $this->assertArrayHasKey('email', $info); $this->assertArrayHasKey('date', $info); $this->assertArrayHasKey('name', $info); $this->assertArrayHasKey('desc', $info); $this->assertArrayHasKey('url', $info); $this->assertEquals('luxtools', $info['base']); $this->assertRegExp('/^https?:\/\//', $info['url']); $this->assertTrue(mail_isvalid($info['email'])); $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); $this->assertTrue(false !== strtotime($info['date'])); } /** * 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)) { self::markTestSkipped('No config default.php exists -> skipping test'); } $conf = null; $meta = null; include($conf_file); $this->assertIsArray( $conf, 'The ' . DOKU_PLUGIN . 'luxtools/conf/default.php file needs to define $conf as an array.' ); 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 = []; } $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.' ); } } }