1<?php
2
3/**
4 * @group tpl_notos
5 * @group plugins
6 */
7class navigation_tpl_notos_test extends DokuWikiTest
8{
9
10    /**
11     * Test parsing control page into navigation structure
12     */
13    public function test_templateinfo()
14    {
15        $file = __DIR__ . '/navigation.txt';
16
17        $templateController = new \dokuwiki\template\twigstarter\TemplateController('main');
18        $customController = new \dokuwiki\template\notos\CustomController($templateController);
19
20        $actual = $customController->parseNavigation($file);
21
22        $expected = [
23            0 =>
24                [
25                    'type' => 'internal',
26                    'page' => 'briefs:start',
27                    'title' => 'Briefs',
28                ],
29            1 =>
30                [
31                    'type' => 'internal',
32                    'page' => 'qhsr:start',
33                    'title' => 'QHSR',
34                    'sub' =>
35                        [
36                            0 =>
37                                [
38                                    'type' => 'internal',
39                                    'page' => 'qhsr:q',
40                                    'title' => 'Quality',
41                                ],
42                            1 =>
43                                [
44                                    'type' => 'internal',
45                                    'page' => 'qhsr:cert',
46                                    'title' => 'Certification',
47                                ],
48                            2 =>
49                                [
50                                    'type' => 'internal',
51                                    'page' => 'qhsr:hse:start',
52                                    'title' => 'HSE',
53                                ],
54                            3 =>
55                                [
56                                    'type' => 'internal',
57                                    'page' => 'qhsr:engsystems',
58                                    'title' => 'Eng Systems',
59                                ],
60                            4 =>
61                                [
62                                    'type' => 'internal',
63                                    'page' => 'qhsr:performance',
64                                    'title' => 'Eng Performance',
65                                ],
66                            5 =>
67                                [
68                                    'type' => 'internal',
69                                    'page' => 'qhsr:competence',
70                                    'title' => 'Eng Competence',
71                                ],
72                            6 =>
73                                [
74                                    'type' => 'internal',
75                                    'page' => 'qhsr:ashford',
76                                    'title' => 'Ashford DFO',
77                                ],
78                            7 =>
79                                [
80                                    'type' => 'internal',
81                                    'page' => 'qhsr:training',
82                                    'title' => 'Technical Training',
83                                ],
84                        ],
85                ],
86            2 =>
87                [
88                    'type' => 'internal',
89                    'page' => 'tech:start',
90                    'title' => 'Tech Info',
91                ],
92            3 =>
93                [
94                    'type' => 'external',
95                    'page' => 'https://homepage.company.com',
96                    'title' => 'Company Homepage',
97                ],
98        ];
99
100        $this->assertEquals($expected, $actual);
101    }
102}
103