xref: /dokuwiki/_test/tests/inc/template_include_page.test.php (revision 4b6ca5c24811fd82c36f2e4a63475d9a300d32dc)
1<?php
2
3class template_pagetitle_test extends DokuWikiTest {
4
5    function test_localID() {
6        global $ID,$ACT;
7
8
9        $id = 'foo:bar';
10
11        $ACT = 'show';
12        $this->assertEquals('foo:bar', tpl_pagetitle($id, true));
13    }
14
15    function test_globalID() {
16        global $ID,$ACT;
17
18
19        $ID = 'foo:bar';
20
21        $ACT = 'show';
22        $this->assertEquals('foo:bar', tpl_pagetitle(null, true));
23    }
24
25    function test_adminTitle() {
26        global $ID,$ACT;
27
28        $ID = 'foo:bar';
29
30        $ACT = 'admin';
31        $this->assertEquals('Admin', tpl_pagetitle(null, true));
32    }
33
34    function test_adminPluginTitle() {
35        global $ID,$ACT,$INPUT,$conf,$INFO;
36        $INFO['isadmin'] = true;
37        $INFO['ismanager'] = true;
38
39        if (!plugin_load('admin','revert')) {
40            $this->markTestSkipped('Revert plugin not found, unable to test admin plugin titles');
41            return;
42        }
43
44        $ID = 'foo:bar';
45        $ACT = 'admin';
46        $conf['lang'] = 'en';
47        $INPUT->set('page','revert');
48
49        $this->assertEquals('Revert Manager', tpl_pagetitle(null, true));
50    }
51
52    function test_nonPageFunctionTitle() {
53        global $ID,$ACT;
54
55        $ID = 'foo:bar';
56
57        $ACT = 'index';
58        $this->assertEquals('Sitemap', tpl_pagetitle(null, true));
59    }
60
61    function test_pageFunctionTitle() {
62        global $ID,$ACT;
63
64        $ID = 'foo:bar';
65
66        $ACT = 'revisions';
67        $this->assertEquals('foo:bar - Old revisions', tpl_pagetitle(null, true));
68    }
69}
70