43 lines
969 B
PHP
43 lines
969 B
PHP
<?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
|
|
|
|
\\\\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');
|
|
}
|
|
}
|