-
Andreas Gohr authored
Template authors now can use tpl_sidebar() to include the sidebar. Sidebars can be defined in subnamespaces as well
Andreas Gohr authoredTemplate authors now can use tpl_sidebar() to include the sidebar. Sidebars can be defined in subnamespaces as well
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
template_sidebar.test.php 1.08 KiB
<?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);
}
}