Scratchpads V1
This commit is contained in:
43
_test/ScratchpadMapTest.php
Normal file
43
_test/ScratchpadMapTest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace dokuwiki\plugin\luxtools\test;
|
||||
|
||||
use dokuwiki\plugin\luxtools\ScratchpadMap;
|
||||
use DokuWikiTest;
|
||||
|
||||
/**
|
||||
* ScratchpadMap tests for the luxtools plugin
|
||||
*
|
||||
* @group plugin_luxtools
|
||||
* @group plugins
|
||||
*/
|
||||
class ScratchpadMapTest extends DokuWikiTest
|
||||
{
|
||||
public function testResolveAndParsing()
|
||||
{
|
||||
$map = new ScratchpadMap(
|
||||
<<<EOT
|
||||
/var/scratchpads/startpad.txt
|
||||
A> start
|
||||
|
||||
C:\\pads\\notes.md
|
||||
A> notes
|
||||
W> ignored
|
||||
|
||||
\\\\server\\share\\pads\\team.txt
|
||||
A> team
|
||||
EOT
|
||||
);
|
||||
|
||||
$this->assertEquals('/var/scratchpads/startpad.txt', $map->resolve('start'));
|
||||
$this->assertEquals('C:/pads/notes.md', $map->resolve('notes'));
|
||||
$this->assertEquals('\\\\server/share/pads/team.txt', $map->resolve('team'));
|
||||
}
|
||||
|
||||
public function testUnknownAliasThrows()
|
||||
{
|
||||
$map = new ScratchpadMap("/tmp/pad.txt\nA> pad\n");
|
||||
$this->expectExceptionMessageMatches('/Unknown scratchpad alias/');
|
||||
$map->resolve('nope');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user