summaryrefslogtreecommitdiff
path: root/_test/tests/inc/template_include_page.test.php
blob: 7dd13ba236be6a3f41f010c4573e7489e1371dcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php

class template_pagetitle_test extends DokuWikiTest {

    function test_localID() {
        global $ID,$ACT;


        $id = 'foo:bar';

        $ACT = 'show';
        $this->assertEquals('foo:bar', tpl_pagetitle($id, true));
    }

    function test_globalID() {
        global $ID,$ACT;


        $ID = 'foo:bar';

        $ACT = 'show';
        $this->assertEquals('foo:bar', tpl_pagetitle(null, true));
    }

    function test_adminTitle() {
        global $ID,$ACT;

        $ID = 'foo:bar';

        $ACT = 'admin';
        $this->assertEquals('Admin', tpl_pagetitle(null, true));
    }

    function test_adminPluginTitle() {
        global $ID,$ACT,$INPUT,$conf;

        if (!plugin_load('admin','revert')) {
            $this->markTestSkipped('Revert plugin not found, unable to test admin plugin titles');
            return;
        }

        $ID = 'foo:bar';
        $ACT = 'admin';
        $conf['lang'] = 'en';
        $INPUT->set('page','revert');

        $this->assertEquals('Revert Manager', tpl_pagetitle(null, true));
    }

    function test_nonPageFunctionTitle() {
        global $ID,$ACT;

        $ID = 'foo:bar';

        $ACT = 'index';
        $this->assertEquals('Sitemap', tpl_pagetitle(null, true));
    }

    function test_pageFunctionTitle() {
        global $ID,$ACT;

        $ID = 'foo:bar';

        $ACT = 'revisions';
        $this->assertEquals('foo:bar - Old revisions', tpl_pagetitle(null, true));
    }
}