1<?php
2
3namespace dokuwiki\plugin\struct\test;
4
5/**
6 * General tests for the struct plugin
7 *
8 * @group plugin_struct
9 * @group plugins
10 */
11class general_plugin_struct_test extends \DokuWikiTest
12{
13
14    /**
15     * Simple test to make sure the plugin.info.txt is in correct format
16     */
17    public function test_plugininfo()
18    {
19        $file = __DIR__ . '/../plugin.info.txt';
20        $this->assertFileExists($file);
21
22        $info = confToHash($file);
23
24        $this->assertArrayHasKey('base', $info);
25        $this->assertArrayHasKey('author', $info);
26        $this->assertArrayHasKey('email', $info);
27        $this->assertArrayHasKey('date', $info);
28        $this->assertArrayHasKey('name', $info);
29        $this->assertArrayHasKey('desc', $info);
30        $this->assertArrayHasKey('url', $info);
31
32        $this->assertEquals('struct', $info['base']);
33        $this->assertRegExp('/^https?:\/\//', $info['url']);
34        $this->assertTrue(mail_isvalid($info['email']));
35        $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
36        $this->assertTrue(false !== strtotime($info['date']));
37    }
38}
39