xref: /dokuwiki/_test/tests/inc/template_include_page.test.php (revision f449b8c9764a91a15cbda1130ef0cd053c48f8e8)
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;
36
37        if (!plugin_load('admin','revert')) {
38            $this->markTestSkipped('Revert plugin not found, unable to test admin plugin titles');
39            return;
40        }
41
42        $ID = 'foo:bar';
43        $ACT = 'admin';
44        $conf['lang'] = 'en';
45        $INPUT->set('page','revert');
46
47        $this->assertEquals('Revert Manager', tpl_pagetitle(null, true));
48    }
49
50    function test_nonPageFunctionTitle() {
51        global $ID,$ACT;
52
53        $ID = 'foo:bar';
54
55        $ACT = 'index';
56        $this->assertEquals('Sitemap', tpl_pagetitle(null, true));
57    }
58
59    function test_pageFunctionTitle() {
60        global $ID,$ACT;
61
62        $ID = 'foo:bar';
63
64        $ACT = 'revisions';
65        $this->assertEquals('foo:bar - Old revisions', tpl_pagetitle(null, true));
66    }
67}
68