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