xref: /dokuwiki/_test/tests/inc/template_include_page.test.php (revision a61966c55d9d0ac4b800d65cfc6ee1aea44899b5)
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() {
35c248bda1SChristopher Smith        global $ID,$ACT,$INPUT,$conf;
36c248bda1SChristopher Smith
37*a61966c5SChristopher Smith        if (!plugin_load('admin','revert')) {
38*a61966c5SChristopher 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';
45*a61966c5SChristopher Smith        $INPUT->set('page','revert');
46c248bda1SChristopher Smith
47*a61966c5SChristopher Smith        $this->assertEquals('Revert Manager', tpl_pagetitle(null, true));
48c248bda1SChristopher Smith    }
49c248bda1SChristopher Smith
50c248bda1SChristopher Smith    function test_nonPageFunctionTitle() {
51c248bda1SChristopher Smith        global $ID,$ACT;
52c248bda1SChristopher Smith
53c248bda1SChristopher Smith        $ID = 'foo:bar';
54c248bda1SChristopher Smith
55c248bda1SChristopher Smith        $ACT = 'index';
56c248bda1SChristopher Smith        $this->assertEquals('Sitemap', tpl_pagetitle(null, true));
57c248bda1SChristopher Smith    }
58c248bda1SChristopher Smith
59c248bda1SChristopher Smith    function test_pageFunctionTitle() {
60c248bda1SChristopher Smith        global $ID,$ACT;
61c248bda1SChristopher Smith
62c248bda1SChristopher Smith        $ID = 'foo:bar';
63c248bda1SChristopher Smith
64c248bda1SChristopher Smith        $ACT = 'revisions';
65c248bda1SChristopher Smith        $this->assertEquals('foo:bar - Old revisions', tpl_pagetitle(null, true));
66c248bda1SChristopher Smith    }
67680b1740SAnika Henke}
68