xref: /plugin/tagging/_test/SyntaxTest.php (revision 55d5df8c4e40f0eede3f71e725efe9b563b29dbd)
1<?php
2
3namespace dokuwiki\plugin\tagging\test;
4
5use \DokuWikiTest;
6
7/**
8 * Syntax tests for the tagging plugin
9 *
10 * @group plugin_tagging
11 * @group plugins
12 */
13class SyntaxTest extends DokuWikiTest
14{
15    protected $pluginsEnabled = ['tagging', 'sqlite'];
16
17    /**
18     * Provide the test data
19     *
20     * @return array
21     */
22    public function nsFilters()
23    {
24        return [
25            [
26                [],
27                'test:plugins:tagging'
28            ],
29            [
30                ['ns' => '*'],
31                ':'
32            ],
33            [
34                ['ns' => 'foo'],
35                'foo'
36            ],
37            [
38                ['ns' => ':foo'],
39                'foo'
40            ],
41            [
42                ['ns' => 'foo:bar'],
43                'foo:bar'
44            ],
45            [
46                ['ns' => '.'],
47                'test:plugins:tagging'
48            ],
49            [
50                ['ns' => '..'],
51                'test:plugins'
52            ],
53            [
54                ['ns' => '.:sub'],
55                'test:plugins:tagging:sub'
56            ],
57        ];
58    }
59
60    /**
61     * Search results
62     *
63     * @dataProvider nsFilters
64     * @param array $data
65     * @param string $expected
66     */
67    public function testNs($data, $expected)
68    {
69        global $ID;
70        $ID = 'test:plugins:tagging:start';
71
72        $hlp = plugin_load('helper', 'tagging');
73
74        $actual = $hlp->resolveNs($data);
75        $this->assertEquals($expected, $actual);
76    }
77}
78