Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4131641
DtdFormatTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DtdFormatTest.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Translate\FileFormatSupport
;
use
FileBasedMessageGroup
;
use
MediaWikiIntegrationTestCase
;
use
MessageGroupBase
;
/**
* The DtdFormat 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
* @license GPL-2.0-or-later
*/
/** @covers \MediaWiki\Extension\Translate\FileFormatSupport\DtdFormat */
class
DtdFormatTest
extends
MediaWikiIntegrationTestCase
{
private
const
GROUP_CONFIGURATION
=
[
'BASIC'
=>
[
'class'
=>
FileBasedMessageGroup
::
class
,
'id'
=>
'test-id'
,
'label'
=>
'Test Label'
,
'namespace'
=>
'NS_MEDIAWIKI'
,
'description'
=>
'Test description'
,
],
'FILES'
=>
[
'format'
=>
'Dtd'
,
],
];
public
function
testParsing
():
void
{
$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
(
self
::
GROUP_CONFIGURATION
);
$dtdFormat
=
new
DtdFormat
(
$group
);
$parsed
=
$dtdFormat
->
readFromVariable
(
$file
);
$expected
=
[
'okawix.title'
=>
'Okawix &okawix.vernum; - Navigator de Wikipedia'
,
'okawix.back'
=>
'Retro'
,
];
$expected
=
[
'MESSAGES'
=>
$expected
,
'AUTHORS'
=>
[
'McDutchie'
]
];
$this
->
assertEquals
(
$expected
,
$parsed
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 11:07 (3 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
96/24/eaa27ebd519051201ef1032d7e71
Default Alt Text
DtdFormatTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment