Passed
Branch master (ad0425)
by Mark
02:23
created

general_plugin_socialcards_test   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 1
c 2
b 0
f 2
lcom 0
cbo 0
dl 0
loc 26
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_plugininfo() 0 20 1
1
<?php
2
/*
3
 * Copyright (c) 2016 Mark C. Prins <[email protected]>
4
 *
5
 * Permission to use, copy, modify, and distribute this software for any
6
 * purpose with or without fee is hereby granted, provided that the above
7
 * copyright notice and this permission notice appear in all copies.
8
 *
9
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
 */
17
18
/**
19
 * General tests for the socialcards plugin
20
 *
21
 * @group plugin_socialcards
22
 * @group plugins
23
 */
24
class general_plugin_socialcards_test extends DokuWikiTest {
25
26
    /**
27
     * Simple test to make sure the plugin.info.txt is in correct format
28
     */
29
    public function test_plugininfo() {
30
        $file = __DIR__ . '/../plugin.info.txt';
31
        $this->assertFileExists($file);
32
33
        $info = confToHash($file);
34
35
        $this->assertArrayHasKey('base', $info);
36
        $this->assertArrayHasKey('author', $info);
37
        $this->assertArrayHasKey('email', $info);
38
        $this->assertArrayHasKey('date', $info);
39
        $this->assertArrayHasKey('name', $info);
40
        $this->assertArrayHasKey('desc', $info);
41
        $this->assertArrayHasKey('url', $info);
42
43
        $this->assertEquals('socialcards', $info['base']);
44
        $this->assertRegExp('/^https?:\/\//', $info['url']);
45
        $this->assertTrue(mail_isvalid($info['email']));
46
        $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
47
        $this->assertTrue(false !== strtotime($info['date']));
48
    }
49
}
50