xref: /dokuwiki/_test/tests/inc/pageutils_nons.test.php (revision 3f6872b1fc0e676dafffb7488df32f2425bbd29f)
1<?php
2
3class init_noNS_test extends DokuWikiTest {
4
5    /**
6     * @dataProvider noNSProvider
7     */
8    public function test_noNS($input, $expected)
9    {
10        global $conf;
11        $conf['start'] = 'start';
12
13        $this->assertSame($expected, noNS($input), $input);
14    }
15
16    public function noNSProvider()
17    {
18        return [
19            ['0:0:0', '0'],
20            ['0:0:start', 'start'],
21            ['foo:0', '0'],
22            ['0', '0'],
23        ];
24    }
25
26    /**
27     * @dataProvider noNSorNSProvider
28     */
29    public function test_noNSorNS($input, $expected)
30    {
31        global $conf;
32        $conf['start'] = 'start';
33
34        $this->assertSame($expected, noNSorNS($input), $input);
35    }
36
37    public function noNSorNSProvider()
38    {
39        return [
40            ['0:0:0', '0'],
41            ['0:0:start', '0'],
42            ['0:start', '0'],
43            ['0:foo', 'foo'],
44            ['foo:0', '0'],
45            ['0', '0'],
46        ];
47    }
48
49}
50//Setup VIM: ex: et ts=4 :
51