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