summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2015-05-28 17:11:42 +0100
committerChristopher Smith <chris@jalakai.co.uk>2015-05-28 17:11:42 +0100
commit4b8290f563ad5ac84dd92fb8ca97ba5970c472b3 (patch)
tree7dca7c98013775628c2b4d1596e0be41d8d4bda2 /_test
parent9a734b7aaba1445e06c1ccb95e59f54e01688d45 (diff)
parent4286c64e98499b93056c09498c10709f8909befd (diff)
downloadrpg-4b8290f563ad5ac84dd92fb8ca97ba5970c472b3.tar.gz
rpg-4b8290f563ad5ac84dd92fb8ca97ba5970c472b3.tar.bz2
Merge branch 'master' into ioreplaceinfile
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/parser/lexer.test.php4
-rw-r--r--_test/tests/inc/tar.test.php454
-rw-r--r--_test/tests/inc/tar/block.txt1
-rw-r--r--_test/tests/inc/tar/foobar/testdata2.txt1
-rw-r--r--_test/tests/inc/tar/longpath-gnu.tgzbin413 -> 0 bytes
-rw-r--r--_test/tests/inc/tar/longpath-ustar.tgzbin311 -> 0 bytes
-rw-r--r--_test/tests/inc/tar/tarbomb.tgzbin183 -> 0 bytes
-rw-r--r--_test/tests/inc/tar/test.tarbin10240 -> 0 bytes
-rw-r--r--_test/tests/inc/tar/test.tbzbin217 -> 0 bytes
-rw-r--r--_test/tests/inc/tar/test.tgzbin220 -> 0 bytes
-rw-r--r--_test/tests/inc/tar/testdata1.txt1
-rw-r--r--_test/tests/inc/tar/zero.txt0
-rw-r--r--_test/tests/inc/template_include_page.test.php77
13 files changed, 54 insertions, 484 deletions
diff --git a/_test/tests/inc/parser/lexer.test.php b/_test/tests/inc/parser/lexer.test.php
index d0965a13e..c50665928 100644
--- a/_test/tests/inc/parser/lexer.test.php
+++ b/_test/tests/inc/parser/lexer.test.php
@@ -146,7 +146,7 @@ class TestOfLexerStateStack extends DokuWikiTest {
}
class TestParser {
- function TestParser() {
+ function __construct() {
}
function accept() {
}
@@ -364,7 +364,7 @@ class TestOfLexerHandlers extends DokuWikiTest {
class TestParserByteIndex {
- function TestParserByteIndex() {}
+ function __construct() {}
function ignore() {}
diff --git a/_test/tests/inc/tar.test.php b/_test/tests/inc/tar.test.php
deleted file mode 100644
index 15453b16d..000000000
--- a/_test/tests/inc/tar.test.php
+++ /dev/null
@@ -1,454 +0,0 @@
-<?php
-
-class Tar_TestCase extends DokuWikiTest {
- /**
- * file extensions that several tests use
- */
- protected $extensions = array('tar');
-
- public function setUp() {
- parent::setUp();
- if (extension_loaded('zlib')) {
- $this->extensions[] = 'tgz';
- }
- if (extension_loaded('bz2')) {
- $this->extensions[] = 'tbz';
- }
- }
-
- /*
- * dependency for tests needing zlib extension to pass
- */
- public function test_ext_zlib() {
- if (!extension_loaded('zlib')) {
- $this->markTestSkipped('skipping all zlib tests. Need zlib extension');
- }
- }
-
- /*
- * dependency for tests needing zlib extension to pass
- */
- public function test_ext_bz2() {
- if (!extension_loaded('bz2')) {
- $this->markTestSkipped('skipping all bzip2 tests. Need bz2 extension');
- }
- }
-
- /**
- * simple test that checks that the given filenames and contents can be grepped from
- * the uncompressed tar stream
- *
- * No check for format correctness
- */
- public function test_createdynamic() {
- $tar = new Tar();
-
- $dir = dirname(__FILE__).'/tar';
- $tdir = ltrim($dir,'/');
-
- $tar->create();
- $tar->AddFile("$dir/testdata1.txt");
- $tar->AddFile("$dir/foobar/testdata2.txt", 'noway/testdata2.txt');
- $tar->addData('another/testdata3.txt', 'testcontent3');
-
- $data = $tar->getArchive();
-
- $this->assertTrue(strpos($data, 'testcontent1') !== false, 'Content in TAR');
- $this->assertTrue(strpos($data, 'testcontent2') !== false, 'Content in TAR');
- $this->assertTrue(strpos($data, 'testcontent3') !== false, 'Content in TAR');
-
- // fullpath might be too long to be stored as full path FS#2802
- $this->assertTrue(strpos($data, "$tdir") !== false, 'Path in TAR');
- $this->assertTrue(strpos($data, "testdata1.txt") !== false, 'File in TAR');
-
- $this->assertTrue(strpos($data, 'noway/testdata2.txt') !== false, 'Path in TAR');
- $this->assertTrue(strpos($data, 'another/testdata3.txt') !== false, 'Path in TAR');
-
- // fullpath might be too long to be stored as full path FS#2802
- $this->assertTrue(strpos($data, "$tdir/foobar") === false, 'Path not in TAR');
- $this->assertTrue(strpos($data, "foobar.txt") === false, 'File not in TAR');
-
- $this->assertTrue(strpos($data, "foobar") === false, 'Path not in TAR');
- }
-
- /**
- * simple test that checks that the given filenames and contents can be grepped from the
- * uncompressed tar file
- *
- * No check for format correctness
- */
- public function test_createfile() {
- $tar = new Tar();
-
- $dir = dirname(__FILE__).'/tar';
- $tdir = ltrim($dir,'/');
- $tmp = tempnam(sys_get_temp_dir(), 'dwtartest');
-
- $tar->create($tmp, Tar::COMPRESS_NONE);
- $tar->AddFile("$dir/testdata1.txt");
- $tar->AddFile("$dir/foobar/testdata2.txt", 'noway/testdata2.txt');
- $tar->addData('another/testdata3.txt', 'testcontent3');
- $tar->close();
-
- $this->assertTrue(filesize($tmp) > 30); //arbitrary non-zero number
- $data = file_get_contents($tmp);
-
- $this->assertTrue(strpos($data, 'testcontent1') !== false, 'Content in TAR');
- $this->assertTrue(strpos($data, 'testcontent2') !== false, 'Content in TAR');
- $this->assertTrue(strpos($data, 'testcontent3') !== false, 'Content in TAR');
-
- // fullpath might be too long to be stored as full path FS#2802
- $this->assertTrue(strpos($data, "$tdir") !== false, "Path in TAR '$tdir'");
- $this->assertTrue(strpos($data, "testdata1.txt") !== false, 'File in TAR');
-
- $this->assertTrue(strpos($data, 'noway/testdata2.txt') !== false, 'Path in TAR');
- $this->assertTrue(strpos($data, 'another/testdata3.txt') !== false, 'Path in TAR');
-
- // fullpath might be too long to be stored as full path FS#2802
- $this->assertTrue(strpos($data, "$tdir/foobar") === false, 'Path not in TAR');
- $this->assertTrue(strpos($data, "foobar.txt") === false, 'File not in TAR');
-
- $this->assertTrue(strpos($data, "foobar") === false, 'Path not in TAR');
-
- @unlink($tmp);
- }
-
- /**
- * List the contents of the prebuilt TAR files
- */
- public function test_tarcontent() {
- $dir = dirname(__FILE__).'/tar';
-
- foreach($this->extensions as $ext) {
- $tar = new Tar();
- $file = "$dir/test.$ext";
-
- $tar->open($file);
- $content = $tar->contents();
-
- $this->assertCount(4, $content, "Contents of $file");
- $this->assertEquals('tar/testdata1.txt', $content[1]['filename'], "Contents of $file");
- $this->assertEquals(13, $content[1]['size'], "Contents of $file");
-
- $this->assertEquals('tar/foobar/testdata2.txt', $content[3]['filename'], "Contents of $file");
- $this->assertEquals(13, $content[1]['size'], "Contents of $file");
- }
- }
-
- /**
- * Extract the prebuilt tar files
- */
- public function test_tarextract() {
- $dir = dirname(__FILE__).'/tar';
- $out = sys_get_temp_dir().'/dwtartest'.md5(time());
-
- foreach($this->extensions as $ext) {
- $tar = new Tar();
- $file = "$dir/test.$ext";
-
- $tar->open($file);
- $tar->extract($out);
-
- clearstatcache();
-
- $this->assertFileExists($out.'/tar/testdata1.txt', "Extracted $file");
- $this->assertEquals(13, filesize($out.'/tar/testdata1.txt'), "Extracted $file");
-
- $this->assertFileExists($out.'/tar/foobar/testdata2.txt', "Extracted $file");
- $this->assertEquals(13, filesize($out.'/tar/foobar/testdata2.txt'), "Extracted $file");
-
- TestUtils::rdelete($out);
- }
- }
-
- /**
- * Extract the prebuilt tar files with component stripping
- */
- public function test_compstripextract() {
- $dir = dirname(__FILE__).'/tar';
- $out = sys_get_temp_dir().'/dwtartest'.md5(time());
-
- foreach($this->extensions as $ext) {
- $tar = new Tar();
- $file = "$dir/test.$ext";
-
- $tar->open($file);
- $tar->extract($out, 1);
-
- clearstatcache();
-
- $this->assertFileExists($out.'/testdata1.txt', "Extracted $file");
- $this->assertEquals(13, filesize($out.'/testdata1.txt'), "Extracted $file");
-
- $this->assertFileExists($out.'/foobar/testdata2.txt', "Extracted $file");
- $this->assertEquals(13, filesize($out.'/foobar/testdata2.txt'), "Extracted $file");
-
- TestUtils::rdelete($out);
- }
- }
-
- /**
- * Extract the prebuilt tar files with prefix stripping
- */
- public function test_prefixstripextract() {
- $dir = dirname(__FILE__).'/tar';
- $out = sys_get_temp_dir().'/dwtartest'.md5(time());
-
- foreach($this->extensions as $ext) {
- $tar = new Tar();
- $file = "$dir/test.$ext";
-
- $tar->open($file);
- $tar->extract($out, 'tar/foobar/');
-
- clearstatcache();
-
- $this->assertFileExists($out.'/tar/testdata1.txt', "Extracted $file");
- $this->assertEquals(13, filesize($out.'/tar/testdata1.txt'), "Extracted $file");
-
- $this->assertFileExists($out.'/testdata2.txt', "Extracted $file");
- $this->assertEquals(13, filesize($out.'/testdata2.txt'), "Extracted $file");
-
- TestUtils::rdelete($out);
- }
- }
-
- /**
- * Extract the prebuilt tar files with include regex
- */
- public function test_includeextract() {
- $dir = dirname(__FILE__).'/tar';
- $out = sys_get_temp_dir().'/dwtartest'.md5(time());
-
- foreach($this->extensions as $ext) {
- $tar = new Tar();
- $file = "$dir/test.$ext";
-
- $tar->open($file);
- $tar->extract($out, '', '', '/\/foobar\//');
-
- clearstatcache();
-
- $this->assertFileNotExists($out.'/tar/testdata1.txt', "Extracted $file");
-
- $this->assertFileExists($out.'/tar/foobar/testdata2.txt', "Extracted $file");
- $this->assertEquals(13, filesize($out.'/tar/foobar/testdata2.txt'), "Extracted $file");
-
- TestUtils::rdelete($out);
- }
- }
-
- /**
- * Extract the prebuilt tar files with exclude regex
- */
- public function test_excludeextract() {
- $dir = dirname(__FILE__).'/tar';
- $out = sys_get_temp_dir().'/dwtartest'.md5(time());
-
- foreach($this->extensions as $ext) {
- $tar = new Tar();
- $file = "$dir/test.$ext";
-
- $tar->open($file);
- $tar->extract($out, '', '/\/foobar\//');
-
- clearstatcache();
-
- $this->assertFileExists($out.'/tar/testdata1.txt', "Extracted $file");
- $this->assertEquals(13, filesize($out.'/tar/testdata1.txt'), "Extracted $file");
-
- $this->assertFileNotExists($out.'/tar/foobar/testdata2.txt', "Extracted $file");
-
- TestUtils::rdelete($out);
- }
- }
-
- /**
- * Check the extension to compression guesser
- */
- public function test_filetype() {
- $tar = new Tar();
- $this->assertEquals(Tar::COMPRESS_NONE, $tar->filetype('foo'));
- $this->assertEquals(Tar::COMPRESS_GZIP, $tar->filetype('foo.tgz'));
- $this->assertEquals(Tar::COMPRESS_GZIP, $tar->filetype('foo.tGZ'));
- $this->assertEquals(Tar::COMPRESS_GZIP, $tar->filetype('foo.tar.GZ'));
- $this->assertEquals(Tar::COMPRESS_GZIP, $tar->filetype('foo.tar.gz'));
- $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tbz'));
- $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tBZ'));
- $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tar.BZ2'));
- $this->assertEquals(Tar::COMPRESS_BZIP, $tar->filetype('foo.tar.bz2'));
- }
-
- /**
- * @depends test_ext_zlib
- */
- public function test_longpathextract() {
- $dir = dirname(__FILE__).'/tar';
- $out = sys_get_temp_dir().'/dwtartest'.md5(time());
-
- foreach(array('ustar', 'gnu') as $format) {
- $tar = new Tar();
- $tar->open("$dir/longpath-$format.tgz");
- $tar->extract($out);
-
- $this->assertFileExists($out.'/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/1234567890/test.txt');
-
- TestUtils::rdelete($out);
- }
- }
-
- // FS#1442
- public function test_createlongfile() {
- $tar = new Tar();
- $tmp = tempnam(sys_get_temp_dir(), 'dwtartest');
-
- $path = '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.txt';
-
- $tar->create($tmp, Tar::COMPRESS_NONE);
- $tar->addData($path, 'testcontent1');
- $tar->close();
-
- $this->assertTrue(filesize($tmp) > 30); //arbitrary non-zero number
- $data = file_get_contents($tmp);
-
- // We should find the complete path and a longlink entry
- $this->assertTrue(strpos($data, 'testcontent1') !== false, 'content in TAR');
- $this->assertTrue(strpos($data, $path) !== false, 'path in TAR');
- $this->assertTrue(strpos($data, '@LongLink') !== false, '@LongLink in TAR');
-
- @unlink($tmp);
- }
-
- public function test_createlongpathustar() {
- $tar = new Tar();
- $tmp = tempnam(sys_get_temp_dir(), 'dwtartest');
-
- $path = '';
- for($i=0; $i<11; $i++) $path .= '1234567890/';
- $path = rtrim($path,'/');
-
- $tar->create($tmp, Tar::COMPRESS_NONE);
- $tar->addData("$path/test.txt", 'testcontent1');
- $tar->close();
-
- $this->assertTrue(filesize($tmp) > 30); //arbitrary non-zero number
- $data = file_get_contents($tmp);
-
- // We should find the path and filename separated, no longlink entry
- $this->assertTrue(strpos($data, 'testcontent1') !== false, 'content in TAR');
- $this->assertTrue(strpos($data, 'test.txt') !== false, 'filename in TAR');
- $this->assertTrue(strpos($data, $path) !== false, 'path in TAR');
- $this->assertFalse(strpos($data, "$path/test.txt") !== false, 'full filename in TAR');
- $this->assertFalse(strpos($data, '@LongLink') !== false, '@LongLink in TAR');
-
- @unlink($tmp);
- }
-
- public function test_createlongpathgnu() {
- $tar = new Tar();
- $tmp = tempnam(sys_get_temp_dir(), 'dwtartest');
-
- $path = '';
- for($i=0; $i<20; $i++) $path .= '1234567890/';
- $path = rtrim($path,'/');
-
- $tar->create($tmp, Tar::COMPRESS_NONE);
- $tar->addData("$path/test.txt", 'testcontent1');
- $tar->close();
-
- $this->assertTrue(filesize($tmp) > 30); //arbitrary non-zero number
- $data = file_get_contents($tmp);
-
- // We should find the complete path/filename and a longlink entry
- $this->assertTrue(strpos($data, 'testcontent1') !== false, 'content in TAR');
- $this->assertTrue(strpos($data, 'test.txt') !== false, 'filename in TAR');
- $this->assertTrue(strpos($data, $path) !== false, 'path in TAR');
- $this->assertTrue(strpos($data, "$path/test.txt") !== false, 'full filename in TAR');
- $this->assertTrue(strpos($data, '@LongLink') !== false, '@LongLink in TAR');
-
- @unlink($tmp);
- }
-
- /**
- * Extract a tarbomomb
- * @depends test_ext_zlib
- */
- public function test_tarbomb() {
- $dir = dirname(__FILE__).'/tar';
- $out = sys_get_temp_dir().'/dwtartest'.md5(time());
-
- $tar = new Tar();
-
- $tar->open("$dir/tarbomb.tgz");
- $tar->extract($out);
-
- clearstatcache();
-
- $this->assertFileExists($out.'/AAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.txt');
-
- TestUtils::rdelete($out);
- }
-
- /**
- * A single zero file should be just a header block + the footer
- */
- public function test_zerofile(){
- $dir = dirname(__FILE__).'/tar';
- $tar = new Tar();
- $tar->create();
- $tar->addFile("$dir/zero.txt", 'zero.txt');
- $file = $tar->getArchive(Tar::COMPRESS_NONE);
-
- $this->assertEquals(512*3, strlen($file)); // 1 header block + 2 footer blocks
- }
-
- public function test_zerodata(){
- $tar = new Tar();
- $tar->create();
- $tar->addData('zero.txt','');
- $file = $tar->getArchive(Tar::COMPRESS_NONE);
-
- $this->assertEquals(512*3, strlen($file)); // 1 header block + 2 footer blocks
- }
-
- /**
- * A file of exactly one block should be just a header block + data block + the footer
- */
- public function test_blockfile(){
- $dir = dirname(__FILE__).'/tar';
- $tar = new Tar();
- $tar->create();
- $tar->addFile("$dir/block.txt", 'block.txt');
- $file = $tar->getArchive(Tar::COMPRESS_NONE);
-
- $this->assertEquals(512*4, strlen($file)); // 1 header block + data block + 2 footer blocks
- }
-
- public function test_blockdata(){
- $tar = new Tar();
- $tar->create();
- $tar->addData('block.txt', str_pad('', 512, 'x'));
- $file = $tar->getArchive(Tar::COMPRESS_NONE);
-
- $this->assertEquals(512*4, strlen($file)); // 1 header block + data block + 2 footer blocks
- }
-
-
- public function test_cleanPath(){
- $tar = new Tar();
- $tests = array (
- '/foo/bar' => 'foo/bar',
- '/foo/bar/' => 'foo/bar',
- 'foo//bar' => 'foo/bar',
- 'foo/0/bar' => 'foo/0/bar',
- 'foo/../bar' => 'bar',
- 'foo/bang/bang/../../bar' => 'foo/bar',
- 'foo/../../bar' => 'bar',
- 'foo/.././../bar' => 'bar',
- );
-
- foreach($tests as $in => $out){
- $this->assertEquals($out, $tar->cleanPath($in), "Input: $in");
- }
- }
-}
diff --git a/_test/tests/inc/tar/block.txt b/_test/tests/inc/tar/block.txt
deleted file mode 100644
index 9b2f53080..000000000
--- a/_test/tests/inc/tar/block.txt
+++ /dev/null
@@ -1 +0,0 @@
-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file
diff --git a/_test/tests/inc/tar/foobar/testdata2.txt b/_test/tests/inc/tar/foobar/testdata2.txt
deleted file mode 100644
index a7db15771..000000000
--- a/_test/tests/inc/tar/foobar/testdata2.txt
+++ /dev/null
@@ -1 +0,0 @@
-testcontent2
diff --git a/_test/tests/inc/tar/longpath-gnu.tgz b/_test/tests/inc/tar/longpath-gnu.tgz
deleted file mode 100644
index 6c937c8fe..000000000
--- a/_test/tests/inc/tar/longpath-gnu.tgz
+++ /dev/null
Binary files differ
diff --git a/_test/tests/inc/tar/longpath-ustar.tgz b/_test/tests/inc/tar/longpath-ustar.tgz
deleted file mode 100644
index 59efbff66..000000000
--- a/_test/tests/inc/tar/longpath-ustar.tgz
+++ /dev/null
Binary files differ
diff --git a/_test/tests/inc/tar/tarbomb.tgz b/_test/tests/inc/tar/tarbomb.tgz
deleted file mode 100644
index 8418d4073..000000000
--- a/_test/tests/inc/tar/tarbomb.tgz
+++ /dev/null
Binary files differ
diff --git a/_test/tests/inc/tar/test.tar b/_test/tests/inc/tar/test.tar
deleted file mode 100644
index 931866b0b..000000000
--- a/_test/tests/inc/tar/test.tar
+++ /dev/null
Binary files differ
diff --git a/_test/tests/inc/tar/test.tbz b/_test/tests/inc/tar/test.tbz
deleted file mode 100644
index 5a7374019..000000000
--- a/_test/tests/inc/tar/test.tbz
+++ /dev/null
Binary files differ
diff --git a/_test/tests/inc/tar/test.tgz b/_test/tests/inc/tar/test.tgz
deleted file mode 100644
index b00319649..000000000
--- a/_test/tests/inc/tar/test.tgz
+++ /dev/null
Binary files differ
diff --git a/_test/tests/inc/tar/testdata1.txt b/_test/tests/inc/tar/testdata1.txt
deleted file mode 100644
index ac65bb32e..000000000
--- a/_test/tests/inc/tar/testdata1.txt
+++ /dev/null
@@ -1 +0,0 @@
-testcontent1
diff --git a/_test/tests/inc/tar/zero.txt b/_test/tests/inc/tar/zero.txt
deleted file mode 100644
index e69de29bb..000000000
--- a/_test/tests/inc/tar/zero.txt
+++ /dev/null
diff --git a/_test/tests/inc/template_include_page.test.php b/_test/tests/inc/template_include_page.test.php
index 47d4d46f1..7dd13ba23 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','revert')) {
+ $this->markTestSkipped('Revert plugin 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','revert');
- $ID = 'foo';
- $sidebar = tpl_include_page('sidebar', false, true);
- $this->assertTrue(strpos($sidebar, 'topsidebar-test') > 0);
+ $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));
+ }
}