1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the PHP Translation package. |
5
|
|
|
* |
6
|
|
|
* (c) PHP Translation team <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Translation\SymfonyStorage\Tests\Unit\Dumper; |
13
|
|
|
|
14
|
|
|
use PHPUnit\Framework\TestCase; |
15
|
|
|
use Symfony\Component\Translation\MessageCatalogue; |
16
|
|
|
use Translation\SymfonyStorage\Dumper\XliffDumper; |
17
|
|
|
|
18
|
|
|
class XliffDumperTest extends TestCase |
19
|
|
|
{ |
20
|
|
|
public function testDumpXliff2Meta() |
21
|
|
|
{ |
22
|
|
|
$catalogue = new MessageCatalogue('en'); |
23
|
|
|
$catalogue->set('key0', 'trans0'); |
24
|
|
|
$catalogue->setMetadata('key0', ['notes' => [ |
25
|
|
|
['content' => 'yes', 'category' => 'approved'], |
26
|
|
|
['content' => 'new', 'category' => 'state'], |
27
|
|
|
]]); |
28
|
|
|
|
29
|
|
|
$catalogue->set('key1', 'trans1'); |
30
|
|
|
$catalogue->setMetadata('key1', ['notes' => [ |
31
|
|
|
['content' => 'cnt', 'priority' => '2'], |
32
|
|
|
]]); |
33
|
|
|
|
34
|
|
|
$dumper = new XliffDumper(); |
35
|
|
|
$output = $dumper->formatCatalogue($catalogue, 'messages', ['xliff_version' => '2.0']); |
36
|
|
|
|
37
|
|
|
$this->assertContains('<note category="approved">yes</note>', $output); |
38
|
|
|
$this->assertContains('<note category="state">new</note>', $output); |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|