Completed
Push — master ( 17b09c...47c6f0 )
by Tobias
05:03
created

XliffDumperTest::testDumpXliff2Meta()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 20
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 13
nc 1
nop 0
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