Files
dokuwiki-plugin-dev/_test/LangProcessorTest.php
Andreas Gohr 5586e97bc4 added cleanLang command
This helps with refactoring larger plugins. The string detection is
using regular expressions and may not find all strings on some occasions
2022-03-14 16:02:45 +01:00

49 lines
1016 B
PHP

<?php
namespace dokuwiki\plugin\dev\test;
use dokuwiki\plugin\dev\LangProcessor;
use DokuWikiTest;
/**
* FIXME tests for the dev plugin
*
* @group plugin_dev
* @group plugins
*/
class LangProcessorTest extends DokuWikiTest
{
public function testPhpExtract()
{
$pl = new LangProcessor(new NullLogger());
$file = __DIR__ . '/testdata/test.php';
$result = $pl->phpExtract($file);
$this->assertEquals([
'string 1' => "$file:4",
'string 2' => "$file:4",
'string 3' => "$file:6",
], $result);
}
public function testJsExtract()
{
$pl = new LangProcessor(new NullLogger());
$file = __DIR__ . '/testdata/test.js';
$result = $pl->jsExtract($file);
$this->assertEquals([
'string1' => "$file:1",
'string 2' => "$file:1",
'string 3' => "$file:3",
'string4' => "$file:5",
'string 5' => "$file:9",
], $result);
}
}