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