summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2015-05-16 17:40:33 +0200
committerChristopher Smith <chris@jalakai.co.uk>2015-05-16 17:40:33 +0200
commitc248bda1dcbef2068071904057b8410aa1eb0200 (patch)
tree2a2adb9f5ab3eeddbd7aabb98ec75acebc376975 /_test
parente7195f3c8d808e1a725b58626e7c3c7397f2417a (diff)
downloadrpg-c248bda1dcbef2068071904057b8410aa1eb0200.tar.gz
rpg-c248bda1dcbef2068071904057b8410aa1eb0200.tar.bz2
fix missing language code parameter for admin plugin titles
add unit test coverage
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/template_include_page.test.php77
1 files changed, 52 insertions, 25 deletions
diff --git a/_test/tests/inc/template_include_page.test.php b/_test/tests/inc/template_include_page.test.php
index 47d4d46f1..580221979 100644
--- a/_test/tests/inc/template_include_page.test.php
+++ b/_test/tests/inc/template_include_page.test.php
@@ -1,40 +1,67 @@
<?php
-class template_include_page_test extends DokuWikiTest {
- function testNoSidebar() {
- global $ID;
+class template_pagetitle_test extends DokuWikiTest {
- $ID = 'foo:bar:baz:test';
- $sidebar = tpl_include_page('sidebar', false, true);
- $this->assertEquals('', $sidebar);
+ function test_localID() {
+ global $ID,$ACT;
+
+
+ $id = 'foo:bar';
+
+ $ACT = 'show';
+ $this->assertEquals('foo:bar', tpl_pagetitle($id, true));
}
- function testExistingSidebars() {
- global $ID;
+ function test_globalID() {
+ global $ID,$ACT;
+
- saveWikiText('sidebar', 'topsidebar-test', '');
+ $ID = 'foo:bar';
- $ID = 'foo:bar:baz:test';
- $sidebar = tpl_include_page('sidebar', false, true);
- $this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0);
+ $ACT = 'show';
+ $this->assertEquals('foo:bar', tpl_pagetitle(null, true));
+ }
+
+ function test_adminTitle() {
+ global $ID,$ACT;
- $ID = 'foo';
- $sidebar = tpl_include_page('sidebar', false, true);
- $this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0);
+ $ID = 'foo:bar';
+
+ $ACT = 'admin';
+ $this->assertEquals('Admin', tpl_pagetitle(null, true));
+ }
- saveWikiText('foo:bar:sidebar', 'bottomsidebar-test', '');
+ function test_adminPluginTitle() {
+ global $ID,$ACT,$INPUT,$conf;
- $ID = 'foo:bar:baz:test';
- $sidebar = tpl_include_page('sidebar', false, true);
- $this->assertTrue(strpos($sidebar, 'bottomsidebar-test') > 0);
+ if (!plugin_load('admin','config')) {
+ $this->markTestSkipped('Plugin Config not found, unable to test admin plugin titles');
+ return;
+ }
- $ID = 'foo:bar:test';
- $sidebar = tpl_include_page('sidebar', false, true);
- $this->assertTrue(strpos($sidebar, 'bottomsidebar-test') > 0);
+ $ID = 'foo:bar';
+ $ACT = 'admin';
+ $conf['lang'] = 'en';
+ $INPUT->set('page','config');
- $ID = 'foo';
- $sidebar = tpl_include_page('sidebar', false, true);
- $this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0);
+ $this->assertEquals('Configuration Settings', 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));
+ }
}