Skip to content

Commit

Permalink
initial automatic cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
splitbrain committed Feb 26, 2024
1 parent 31b4eb6 commit 1c9be82
Show file tree
Hide file tree
Showing 8 changed files with 653 additions and 238 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.* export-ignore
/_test export-ignore
11 changes: 11 additions & 0 deletions .github/workflows/dokuwiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: DokuWiki Default Tasks
on:
push:
pull_request:
schedule:
- cron: '58 2 25 * *'


jobs:
all:
uses: dokuwiki/github-action/.github/workflows/all.yml@main
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

339 changes: 339 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions _test/GeneralTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace dokuwiki\plugin\filelist\test;

use DokuWikiTest;

/**
* General tests for the filelist plugin
*
* @group plugin_filelist
* @group plugins
*/
class GeneralTest extends DokuWikiTest
{

/**
* Simple test to make sure the plugin.info.txt is in correct format
*/
public function testPluginInfo(): void
{
$file = __DIR__ . '/../plugin.info.txt';
$this->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('filelist', $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']));
}

/**
* Test to ensure that every conf['...'] entry in conf/default.php has a corresponding meta['...'] entry in
* conf/metadata.php.
*/
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)) {
include($conf_file);
}
if (file_exists($meta_file)) {
include($meta_file);
}

$this->assertEquals(
gettype($conf),
gettype($meta),
'Both ' . DOKU_PLUGIN . 'filelist/conf/default.php and ' . DOKU_PLUGIN . 'filelist/conf/metadata.php have to exist and contain the same keys.'
);

if ($conf !== null && $meta !== null) {
foreach ($conf as $key => $value) {
$this->assertArrayHasKey(
$key,
$meta,
'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelist/conf/metadata.php'
);
}

foreach ($meta as $key => $value) {
$this->assertArrayHasKey(
$key,
$conf,
'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelist/conf/default.php'
);
}
}

}
}
1 change: 1 addition & 0 deletions conf/default.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Options for the filelist plugin
*/
Expand Down
2 changes: 1 addition & 1 deletion conf/metadata.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Metadata for configuration manager plugin
* Additions for the filelist plugin
Expand All @@ -11,4 +12,3 @@
$meta['web_paths'] = array('');
$meta['defaults'] = array('string');
$meta['extensions'] = array('string');

Loading

0 comments on commit 1c9be82

Please sign in to comment.