xref: /dokuwiki/_test/tests/inc/template_include_page.test.php (revision 48ca2703a1a540d933cb236019e71c853fa9496b)
1680b1740SAnika Henke<?php
2680b1740SAnika Henke
3c248bda1SChristopher Smithclass template_pagetitle_test extends DokuWikiTest {
4680b1740SAnika Henke
5c248bda1SChristopher Smith    function test_localID() {
6c248bda1SChristopher Smith        global $ID,$ACT;
7c248bda1SChristopher Smith
8c248bda1SChristopher Smith
9c248bda1SChristopher Smith        $id = 'foo:bar';
10c248bda1SChristopher Smith
11c248bda1SChristopher Smith        $ACT = 'show';
12c248bda1SChristopher Smith        $this->assertEquals('foo:bar', tpl_pagetitle($id, true));
13680b1740SAnika Henke    }
14680b1740SAnika Henke
15c248bda1SChristopher Smith    function test_globalID() {
16c248bda1SChristopher Smith        global $ID,$ACT;
17680b1740SAnika Henke
18680b1740SAnika Henke
19c248bda1SChristopher Smith        $ID = 'foo:bar';
20680b1740SAnika Henke
21c248bda1SChristopher Smith        $ACT = 'show';
22c248bda1SChristopher Smith        $this->assertEquals('foo:bar', tpl_pagetitle(null, true));
23680b1740SAnika Henke    }
24680b1740SAnika Henke
25c248bda1SChristopher Smith    function test_adminTitle() {
26c248bda1SChristopher Smith        global $ID,$ACT;
27c248bda1SChristopher Smith
28c248bda1SChristopher Smith        $ID = 'foo:bar';
29c248bda1SChristopher Smith
30c248bda1SChristopher Smith        $ACT = 'admin';
31c248bda1SChristopher Smith        $this->assertEquals('Admin', tpl_pagetitle(null, true));
32c248bda1SChristopher Smith    }
33c248bda1SChristopher Smith
34c248bda1SChristopher Smith    function test_adminPluginTitle() {
35*48ca2703SAndreas Gohr        global $ID,$ACT,$INPUT,$conf,$USERINFO;
36c248bda1SChristopher Smith
37a61966c5SChristopher Smith        if (!plugin_load('admin','revert')) {
38a61966c5SChristopher Smith            $this->markTestSkipped('Revert plugin not found, unable to test admin plugin titles');
39c248bda1SChristopher Smith            return;
40c248bda1SChristopher Smith        }
41c248bda1SChristopher Smith
42c248bda1SChristopher Smith        $ID = 'foo:bar';
43c248bda1SChristopher Smith        $ACT = 'admin';
44c248bda1SChristopher Smith        $conf['lang'] = 'en';
45a61966c5SChristopher Smith        $INPUT->set('page','revert');
46c248bda1SChristopher Smith
47*48ca2703SAndreas Gohr        $INPUT->server->set('REMOTE_USER', 'testuser'); // this user is admin
48a61966c5SChristopher Smith        $this->assertEquals('Revert Manager', tpl_pagetitle(null, true));
49c248bda1SChristopher Smith    }
50c248bda1SChristopher Smith
51c248bda1SChristopher Smith    function test_nonPageFunctionTitle() {
52c248bda1SChristopher Smith        global $ID,$ACT;
53c248bda1SChristopher Smith
54c248bda1SChristopher Smith        $ID = 'foo:bar';
55c248bda1SChristopher Smith
56c248bda1SChristopher Smith        $ACT = 'index';
57c248bda1SChristopher Smith        $this->assertEquals('Sitemap', tpl_pagetitle(null, true));
58c248bda1SChristopher Smith    }
59c248bda1SChristopher Smith
60c248bda1SChristopher Smith    function test_pageFunctionTitle() {
61c248bda1SChristopher Smith        global $ID,$ACT;
62c248bda1SChristopher Smith
63c248bda1SChristopher Smith        $ID = 'foo:bar';
64c248bda1SChristopher Smith
65c248bda1SChristopher Smith        $ACT = 'revisions';
66c248bda1SChristopher Smith        $this->assertEquals('foo:bar - Old revisions', tpl_pagetitle(null, true));
67c248bda1SChristopher Smith    }
68680b1740SAnika Henke}
69