Passed
Pull Request — master (#3)
by
unknown
02:08 queued 20s
created

general_plugin_description_test   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 20
c 1
b 0
f 0
dl 0
loc 38
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_plugininfo() 0 20 1
A test_plugin_description_isloaded() 0 5 1
1
<?php
2
/*
3
 * @phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
4
 * @noinspection AutoloadingIssuesInspection
5
 */
6
7
/**
8
 * General tests for the description plugin
9
 *
10
 * @group plugin_description
11
 * @group plugins
12
 *
13
 * @author Mark C. Prins <[email protected]>
14
 */
15
class general_plugin_description_test extends DokuWikiTest
1 ignored issue
show
Bug introduced by
The type DokuWikiTest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
{
17
18
    protected $pluginsEnabled = array('description');
19
20
    /**
21
     * Simple test to make sure the plugin.info.txt is in correct format
22
     */
23
    public function test_plugininfo(): void
24
    {
25
        $file = __DIR__ . '/../plugin.info.txt';
26
        $this->assertFileExists($file);
27
28
        $info = confToHash($file);
1 ignored issue
show
Bug introduced by
The function confToHash was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        $info = /** @scrutinizer ignore-call */ confToHash($file);
Loading history...
29
30
        $this->assertArrayHasKey('base', $info);
31
        $this->assertArrayHasKey('author', $info);
32
        $this->assertArrayHasKey('email', $info);
33
        $this->assertArrayHasKey('date', $info);
34
        $this->assertArrayHasKey('name', $info);
35
        $this->assertArrayHasKey('desc', $info);
36
        $this->assertArrayHasKey('url', $info);
37
38
        $this->assertEquals('description', $info['base']);
39
        $this->assertRegExp('/^https?:\/\//', $info['url']);
40
        $this->assertTrue(mail_isvalid($info['email']));
1 ignored issue
show
Bug introduced by
The function mail_isvalid was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
        $this->assertTrue(/** @scrutinizer ignore-call */ mail_isvalid($info['email']));
Loading history...
41
        $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
42
        $this->assertTrue(false !== strtotime($info['date']));
43
    }
44
45
    /**
46
     * test if plugin is loaded.
47
     */
48
    public function test_plugin_description_isloaded()
49
    {
50
        global $plugin_controller;
51
        $this->assertContains(
52
            'description', $plugin_controller->getList(), "description plugin is loaded"
53
        );
54
    }
55
}
56