Passed
Pull Request — master (#4)
by Mark
01:28
created

syntax_plugin_description_test::setUpBeforeClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
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 syntax_plugin_description_test extends DokuWikiTest
15
{
16
    protected $pluginsEnabled = array('description');
17
18
    /**
19
     * copy data and add pages to the index.
20
     */
21
    public static function setUpBeforeClass(): void
22
    {
23
        parent::setUpBeforeClass();
24
        TestUtils::rcopy(TMP_DIR, __DIR__ . '/data/');
25
    }
26
27
    /**
28
     * @throws Exception if anything goes wrong
29
     */
30
    final public function testHeaderFromSyntax(): void
31
    {
32
        global $conf;
33
        $conf['keyword_source'] = 'syntax';
34
35
        $index = plugin_load('syntax', 'description');
36
        $this->assertTrue($index instanceof syntax_plugin_description);
37
38
        $request = new TestRequest();
39
        $response = $request->get(array('id' => 'wiki:syntax'));
40
41
        // check description meta headers, set from file
42
        $this->assertStringContainsString(
43
            'Place the page description here',
44
            $response->queryHTML('meta[name="description"]')->attr('content')
45
        );
46
    }
47
}