Skip to content

Commit 6553f23

Browse files
committed
use newer DokuWiki test workflow
1 parent 887d547 commit 6553f23

File tree

3 files changed

+95
-49
lines changed

3 files changed

+95
-49
lines changed

.github/workflows/dokuwiki.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: DokuWiki Default Tasks
2+
on:
3+
push:
4+
pull_request:
5+
schedule:
6+
- cron: '58 6 5 * *'
7+
8+
9+
jobs:
10+
all:
11+
uses: dokuwiki/github-action/.github/workflows/all.yml@main

.github/workflows/phpTestLinux.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

_test/GeneralTest.php

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
3+
namespace dokuwiki\plugin\include\test;
4+
5+
use DokuWikiTest;
6+
7+
/**
8+
* General tests for the include plugin
9+
*
10+
* @group plugin_include
11+
* @group plugins
12+
*/
13+
class GeneralTest extends DokuWikiTest
14+
{
15+
/**
16+
* Simple test to make sure the plugin.info.txt is in correct format
17+
*/
18+
public function testPluginInfo(): void
19+
{
20+
$file = __DIR__ . '/../plugin.info.txt';
21+
$this->assertFileExists($file);
22+
23+
$info = confToHash($file);
24+
25+
$this->assertArrayHasKey('base', $info);
26+
$this->assertArrayHasKey('author', $info);
27+
$this->assertArrayHasKey('email', $info);
28+
$this->assertArrayHasKey('date', $info);
29+
$this->assertArrayHasKey('name', $info);
30+
$this->assertArrayHasKey('desc', $info);
31+
$this->assertArrayHasKey('url', $info);
32+
33+
$this->assertEquals('include', $info['base']);
34+
$this->assertMatchesRegularExpression('/^https?:\/\//', $info['url']);
35+
$this->assertTrue(mail_isvalid($info['email']));
36+
$this->assertMatchesRegularExpression('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
37+
$this->assertTrue(false !== strtotime($info['date']));
38+
}
39+
40+
/**
41+
* Test to ensure that every conf['...'] entry in conf/default.php has a corresponding meta['...'] entry in
42+
* conf/metadata.php.
43+
*/
44+
public function testPluginConf(): void
45+
{
46+
$conf_file = __DIR__ . '/../conf/default.php';
47+
$meta_file = __DIR__ . '/../conf/metadata.php';
48+
49+
if (!file_exists($conf_file) && !file_exists($meta_file)) {
50+
self::markTestSkipped('No config files exist -> skipping test');
51+
}
52+
53+
if (file_exists($conf_file)) {
54+
include($conf_file);
55+
}
56+
if (file_exists($meta_file)) {
57+
include($meta_file);
58+
}
59+
60+
$this->assertEquals(
61+
gettype($conf),
62+
gettype($meta),
63+
'Both ' . DOKU_PLUGIN . 'include/conf/default.php and ' . DOKU_PLUGIN . 'include/conf/metadata.php have to exist and contain the same keys.'
64+
);
65+
66+
if ($conf !== null && $meta !== null) {
67+
foreach ($conf as $key => $value) {
68+
$this->assertArrayHasKey(
69+
$key,
70+
$meta,
71+
'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'include/conf/metadata.php'
72+
);
73+
}
74+
75+
foreach ($meta as $key => $value) {
76+
$this->assertArrayHasKey(
77+
$key,
78+
$conf,
79+
'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'include/conf/default.php'
80+
);
81+
}
82+
}
83+
}
84+
}

0 commit comments

Comments
 (0)