global_plugin_description_test::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Syntax 'keyword_source' tests for the description plugin.
5
 *
6
 * @group plugin_description
7
 * @group plugins
8
 *
9
 * @author Mark C. Prins <[email protected]>
10
 *
11
 * @noinspection AutoloadingIssuesInspection
12
 * @phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
13
 */
14
class global_plugin_description_test extends DokuWikiTest
15
{
16
    protected $pluginsEnabled = array('description');
17
18
    /**
19
     * copy data and pages.
20
     */
21
    public static function setUpBeforeClass(): void
22
    {
23
        parent::setUpBeforeClass();
24
        TestUtils::rcopy(TMP_DIR, __DIR__ . '/data/');
25
    }
26
27
    final public function setUp(): void
28
    {
29
        global $conf;
30
        parent::setUp();
31
        $conf['plugin']['description']['keyword_source'] = 'global';
32
        $conf['plugin']['description']['global_description'] = 'my global description';
33
    }
34
35
    /**
36
     * @throws Exception if anything goes wrong
37
     */
38
    final public function testHeaderFromSyntax(): void
39
    {
40
        $index = plugin_load('syntax', 'description');
41
        $this->assertInstanceOf(syntax_plugin_description::class, $index);
42
43
        $request = new TestRequest();
44
        $response = $request->get(array('id' => 'description_syntax'));
45
46
        // check description meta headers, set from file
47
        $this->assertEquals(
48
            'my global description',
49
            $response->queryHTML('meta[name="description"]')->attr('content')
50
        );
51
    }
52
}