summaryrefslogtreecommitdiff
path: root/_test/tests/inc/template_sidebar.test.php
blob: 56153894ab47c0e030845d4ee17d627e14d372d1 (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
<?php

class template_sidebar_test extends DokuWikiTest {
    function testNoSidebar() {
        global $ID;

        $ID = 'foo:bar:baz:test';
        $sidebar = tpl_sidebar(false);
        $this->assertEquals('',$sidebar);
    }

    function testExistingSidebars() {
        global $ID;

        saveWikiText('sidebar', 'topsidebar-test', '');

        $ID = 'foo:bar:baz:test';
        $sidebar = tpl_sidebar(false);
        $this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0);

        $ID = 'foo';
        $sidebar = tpl_sidebar(false);
        $this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0);

        saveWikiText('foo:bar:sidebar', 'bottomsidebar-test', '');

        $ID = 'foo:bar:baz:test';
        $sidebar = tpl_sidebar(false);
        $this->assertTrue(strpos($sidebar, 'bottomsidebar-test') > 0);

        $ID = 'foo:bar:test';
        $sidebar = tpl_sidebar(false);
        $this->assertTrue(strpos($sidebar, 'bottomsidebar-test') > 0);

        $ID = 'foo';
        $sidebar = tpl_sidebar(false);
        $this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0);
    }

}