xref: /plugin/dev/_test/LangProcessorTest.php (revision 5586e97bc4b65dc3b74336eb94fcf840074db1c4)
1*5586e97bSAndreas Gohr<?php
2*5586e97bSAndreas Gohr
3*5586e97bSAndreas Gohrnamespace dokuwiki\plugin\dev\test;
4*5586e97bSAndreas Gohr
5*5586e97bSAndreas Gohruse dokuwiki\plugin\dev\LangProcessor;
6*5586e97bSAndreas Gohruse DokuWikiTest;
7*5586e97bSAndreas Gohr
8*5586e97bSAndreas Gohr/**
9*5586e97bSAndreas Gohr * FIXME tests for the dev plugin
10*5586e97bSAndreas Gohr *
11*5586e97bSAndreas Gohr * @group plugin_dev
12*5586e97bSAndreas Gohr * @group plugins
13*5586e97bSAndreas Gohr */
14*5586e97bSAndreas Gohrclass LangProcessorTest extends DokuWikiTest
15*5586e97bSAndreas Gohr{
16*5586e97bSAndreas Gohr
17*5586e97bSAndreas Gohr    public function testPhpExtract()
18*5586e97bSAndreas Gohr    {
19*5586e97bSAndreas Gohr        $pl = new LangProcessor(new NullLogger());
20*5586e97bSAndreas Gohr
21*5586e97bSAndreas Gohr        $file = __DIR__ . '/testdata/test.php';
22*5586e97bSAndreas Gohr        $result = $pl->phpExtract($file);
23*5586e97bSAndreas Gohr
24*5586e97bSAndreas Gohr        $this->assertEquals([
25*5586e97bSAndreas Gohr            'string 1' => "$file:4",
26*5586e97bSAndreas Gohr            'string 2' => "$file:4",
27*5586e97bSAndreas Gohr            'string 3' => "$file:6",
28*5586e97bSAndreas Gohr        ], $result);
29*5586e97bSAndreas Gohr    }
30*5586e97bSAndreas Gohr
31*5586e97bSAndreas Gohr    public function testJsExtract()
32*5586e97bSAndreas Gohr    {
33*5586e97bSAndreas Gohr        $pl = new LangProcessor(new NullLogger());
34*5586e97bSAndreas Gohr
35*5586e97bSAndreas Gohr        $file = __DIR__ . '/testdata/test.js';
36*5586e97bSAndreas Gohr        $result = $pl->jsExtract($file);
37*5586e97bSAndreas Gohr
38*5586e97bSAndreas Gohr        $this->assertEquals([
39*5586e97bSAndreas Gohr            'string1' => "$file:1",
40*5586e97bSAndreas Gohr            'string 2' => "$file:1",
41*5586e97bSAndreas Gohr            'string 3' => "$file:3",
42*5586e97bSAndreas Gohr            'string4' => "$file:5",
43*5586e97bSAndreas Gohr            'string 5' => "$file:9",
44*5586e97bSAndreas Gohr        ], $result);
45*5586e97bSAndreas Gohr    }
46*5586e97bSAndreas Gohr
47*5586e97bSAndreas Gohr}
48*5586e97bSAndreas Gohr
49