Change project name to filetools

This commit is contained in:
2026-01-05 10:37:51 +01:00
parent a3558c470e
commit fe8d0bbffb
15 changed files with 77 additions and 74 deletions

View File

@@ -1,13 +1,13 @@
<?php
namespace dokuwiki\plugin\filelistplus\test;
namespace dokuwiki\plugin\filetools\test;
use DokuWikiTest;
/**
* General tests for the filelistplus plugin
* General tests for the filetools plugin
*
* @group plugin_filelistplus
* @group plugin_filetools
* @group plugins
*/
class GeneralTest extends DokuWikiTest
@@ -31,7 +31,7 @@ class GeneralTest extends DokuWikiTest
$this->assertArrayHasKey('desc', $info);
$this->assertArrayHasKey('url', $info);
$this->assertEquals('filelistplus', $info['base']);
$this->assertEquals('filetools', $info['base']);
$this->assertRegExp('/^https?:\/\//', $info['url']);
$this->assertTrue(mail_isvalid($info['email']));
$this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
@@ -61,7 +61,7 @@ class GeneralTest extends DokuWikiTest
$this->assertEquals(
gettype($conf),
gettype($meta),
'Both ' . DOKU_PLUGIN . 'filelistplus/conf/default.php and ' . DOKU_PLUGIN . 'filelistplus/conf/metadata.php have to exist and contain the same keys.'
'Both ' . DOKU_PLUGIN . 'filetools/conf/default.php and ' . DOKU_PLUGIN . 'filetools/conf/metadata.php have to exist and contain the same keys.'
);
if ($conf !== null && $meta !== null) {
@@ -69,7 +69,7 @@ class GeneralTest extends DokuWikiTest
$this->assertArrayHasKey(
$key,
$meta,
'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelistplus/conf/metadata.php'
'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filetools/conf/metadata.php'
);
}
@@ -77,7 +77,7 @@ class GeneralTest extends DokuWikiTest
$this->assertArrayHasKey(
$key,
$conf,
'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filelistplus/conf/default.php'
'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'filetools/conf/default.php'
);
}
}

View File

@@ -1,14 +1,14 @@
<?php
namespace dokuwiki\plugin\filelistplus\test;
namespace dokuwiki\plugin\filetools\test;
use dokuwiki\plugin\filelistplus\Path;
use dokuwiki\plugin\filetools\Path;
use DokuWikiTest;
/**
* Path related tests for the filelistplus plugin
* Path related tests for the filetools plugin
*
* @group plugin_filelistplus
* @group plugin_filetools
* @group plugins
*/
class PathTest extends DokuWikiTest
@@ -40,15 +40,15 @@ EOT
$expect = [
'C:/xampp/htdocs/wiki/' => [
'root' => 'C:/xampp/htdocs/wiki/',
'web' => '/lib/plugins/filelistplus/file.php?root=C%3A%2Fxampp%2Fhtdocs%2Fwiki%2F&file=',
'web' => '/lib/plugins/filetools/file.php?root=C%3A%2Fxampp%2Fhtdocs%2Fwiki%2F&file=',
],
'\\\\server/share/path/' => [
'root' => '\\\\server/share/path/',
'web' => '/lib/plugins/filelistplus/file.php?root=%5C%5Cserver%2Fshare%2Fpath%2F&file=',
'web' => '/lib/plugins/filetools/file.php?root=%5C%5Cserver%2Fshare%2Fpath%2F&file=',
],
'/linux/file/path/' => [
'root' => '/linux/file/path/',
'web' => '/lib/plugins/filelistplus/file.php?root=%2Flinux%2Ffile%2Fpath%2F&file=',
'web' => '/lib/plugins/filetools/file.php?root=%2Flinux%2Ffile%2Fpath%2F&file=',
],
'/linux/another/path/' => [
'root' => '/linux/another/path/',

View File

@@ -1,35 +1,35 @@
<?php
namespace dokuwiki\plugin\filelistplus\test;
namespace dokuwiki\plugin\filetools\test;
use DokuWikiTest;
use DOMWrap\Document;
/**
* Tests for the filelistplus plugin.
* Tests for the filetools plugin.
*
* These test assume that the directory filelistplus has the following content:
* These test assume that the directory filetools has the following content:
* - exampledir (directory)
* - example2.txt (text file)
* - example.txt (text file)
* - exampleimage.png (image file)
*
* @group plugin_filelistplus
* @group plugin_filetools
* @group plugins
*/
class plugin_filelistplus_test extends DokuWikiTest
class plugin_filetools_test extends DokuWikiTest
{
public function setUp(): void
{
global $conf;
$this->pluginsEnabled[] = 'filelistplus';
$this->pluginsEnabled[] = 'filetools';
parent::setUp();
// Setup config so that access to the TMP directory will be allowed
$conf ['plugin']['filelistplus']['paths'] = TMP_DIR . '/filelistdata/' . "\n" . 'W> http://localhost/';
$conf ['plugin']['filetools']['paths'] = TMP_DIR . '/filelistdata/' . "\n" . 'W> http://localhost/';
}
@@ -76,7 +76,7 @@ class plugin_filelistplus_test extends DokuWikiTest
global $conf;
// Render filelist
$instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=list&direct=1}}');
$instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=list&direct=1}}');
$xhtml = p_render('xhtml', $instructions, $info);
// We should find:
@@ -94,7 +94,7 @@ class plugin_filelistplus_test extends DokuWikiTest
public function test_recursive()
{
// Render filelist
$instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}');
$instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}');
$xhtml = p_render('xhtml', $instructions, $info);
// We should find:
@@ -119,21 +119,21 @@ class plugin_filelistplus_test extends DokuWikiTest
public function testUnorderedList()
{
// Render filelist
$instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}');
$instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=list&direct=1&recursive=1}}');
$xhtml = p_render('xhtml', $instructions, $info);
$doc = new Document();
$doc->html($xhtml);
$structure = [
'div.filelistplus-plugin' => 1,
'div.filelistplus-plugin > ul' => 1,
'div.filelistplus-plugin > ul > li' => 3,
'div.filelistplus-plugin > ul > li:nth-child(1)' => 1,
'div.filelistplus-plugin > ul > li:nth-child(1) a' => 'example.txt',
'div.filelistplus-plugin > ul > li:nth-child(2) ul' => 1,
'div.filelistplus-plugin > ul > li:nth-child(2) ul > li' => 1,
'div.filelistplus-plugin > ul > li:nth-child(2) ul > li a' => 'example2.txt',
'div.filetools-plugin' => 1,
'div.filetools-plugin > ul' => 1,
'div.filetools-plugin > ul > li' => 3,
'div.filetools-plugin > ul > li:nth-child(1)' => 1,
'div.filetools-plugin > ul > li:nth-child(1) a' => 'example.txt',
'div.filetools-plugin > ul > li:nth-child(2) ul' => 1,
'div.filetools-plugin > ul > li:nth-child(2) ul > li' => 1,
'div.filetools-plugin > ul > li:nth-child(2) ul > li a' => 'example2.txt',
];
$this->structureCheck($doc, $structure);
@@ -146,21 +146,21 @@ class plugin_filelistplus_test extends DokuWikiTest
public function testOrderedList()
{
// Render filelist
$instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=olist&direct=1&recursive=1}}');
$instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=olist&direct=1&recursive=1}}');
$xhtml = p_render('xhtml', $instructions, $info);
$doc = new Document();
$doc->html($xhtml);
$structure = [
'div.filelistplus-plugin' => 1,
'div.filelistplus-plugin > ol' => 1,
'div.filelistplus-plugin > ol > li' => 3,
'div.filelistplus-plugin > ol > li:nth-child(1)' => 1,
'div.filelistplus-plugin > ol > li:nth-child(1) a' => 'example.txt',
'div.filelistplus-plugin > ol > li:nth-child(2) ol' => 1,
'div.filelistplus-plugin > ol > li:nth-child(2) ol > li' => 1,
'div.filelistplus-plugin > ol > li:nth-child(2) ol > li a' => 'example2.txt',
'div.filetools-plugin' => 1,
'div.filetools-plugin > ol' => 1,
'div.filetools-plugin > ol > li' => 3,
'div.filetools-plugin > ol > li:nth-child(1)' => 1,
'div.filetools-plugin > ol > li:nth-child(1) a' => 'example.txt',
'div.filetools-plugin > ol > li:nth-child(2) ol' => 1,
'div.filetools-plugin > ol > li:nth-child(2) ol > li' => 1,
'div.filetools-plugin > ol > li:nth-child(2) ol > li a' => 'example2.txt',
];
$this->structureCheck($doc, $structure);
@@ -175,19 +175,19 @@ class plugin_filelistplus_test extends DokuWikiTest
global $conf;
// Render filelist
$instructions = p_get_instructions('{{filelistplus>' . TMP_DIR . '/filelistdata/*&style=table&direct=1&recursive=1}}');
$instructions = p_get_instructions('{{files>' . TMP_DIR . '/filelistdata/*&style=table&direct=1&recursive=1}}');
$xhtml = p_render('xhtml', $instructions, $info);
$doc = new Document();
$doc->html($xhtml);
$structure = [
'div.filelistplus-plugin' => 1,
'div.filelistplus-plugin table' => 1,
'div.filelistplus-plugin table > tbody > tr' => 3,
'div.filelistplus-plugin table > tbody > tr:nth-child(1) a' => 'example.txt',
'div.filelistplus-plugin table > tbody > tr:nth-child(2) a' => 'exampledir/example2.txt',
'div.filelistplus-plugin table > tbody > tr:nth-child(3) a' => 'exampleimage.png',
'div.filetools-plugin' => 1,
'div.filetools-plugin table' => 1,
'div.filetools-plugin table > tbody > tr' => 3,
'div.filetools-plugin table > tbody > tr:nth-child(1) a' => 'example.txt',
'div.filetools-plugin table > tbody > tr:nth-child(2) a' => 'exampledir/example2.txt',
'div.filetools-plugin table > tbody > tr:nth-child(3) a' => 'exampleimage.png',
];
$this->structureCheck($doc, $structure);