blob: b5bb5ff3f5b52e416806be1911784c1205e2f8cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
/**
* The DtdFFS class is responsible for loading messages from .dtd
* files.
* These tests check that the message keys are loaded and saved correctly.
* @author Niklas Laxström
* @author Amir E. Aharoni
* @file
* @license GPL-2.0-or-later
*/
class DtdFFSTest extends MediaWikiIntegrationTestCase {
protected $groupConfiguration = [
'BASIC' => [
'class' => FileBasedMessageGroup::class,
'id' => 'test-id',
'label' => 'Test Label',
'namespace' => 'NS_MEDIAWIKI',
'description' => 'Test description',
],
'FILES' => [
'class' => DtdFFS::class,
],
];
public function testParsing() {
$file =
<<<DTD
<!--
# Messages for Interlingua (interlingua)
# Exported from translatewiki.net
# Author: McDutchie
-->
<!ENTITY okawix.title "Okawix &okawix.vernum; - Navigator de Wikipedia">
<!ENTITY okawix.back
"Retro">
DTD;
/** @var FileBasedMessageGroup $group */
$group = MessageGroupBase::factory( $this->groupConfiguration );
$ffs = new DtdFFS( $group );
$parsed = $ffs->readFromVariable( $file );
$expected = [
'okawix.title' => 'Okawix &okawix.vernum; - Navigator de Wikipedia',
'okawix.back' => 'Retro',
];
$expected = [ 'MESSAGES' => $expected, 'AUTHORS' => [ 'McDutchie' ] ];
$this->assertEquals( $expected, $parsed );
}
}
|