Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4107079
MessageGroupCacheTest.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
MessageGroupCacheTest.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Translate\MessageGroupProcessing
;
use
FileBasedMessageGroup
;
use
MediaWikiIntegrationTestCase
;
/**
* @author Niklas Laxström
* @license GPL-2.0-or-later
* @covers MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupCache
*/
class
MessageGroupCacheTest
extends
MediaWikiIntegrationTestCase
{
public
function
testCacheRoundtrip
()
{
$parseOutput
=
[
'AUTHORS'
=>
[
'Bunny the king of the carrot land'
],
'MESSAGES'
=>
[
'x-message'
=>
'fluffy'
,
'b-message'
=>
'animal'
,
'X-message'
=>
'with'
,
'a-message'
=>
'ears'
,
],
'EXTRA'
=>
[
'food'
=>
'carrot'
],
];
$group
=
$this
->
createMock
(
FileBasedMessageGroup
::
class
);
$group
->
method
(
'getSourceFilePath'
)->
willReturn
(
__FILE__
);
$group
->
method
(
'parseExternal'
)->
willReturn
(
$parseOutput
);
$cache
=
new
MessageGroupCache
(
$group
,
'en'
,
$this
->
getNewTempFile
()
);
$cache
->
create
();
$expected
=
array_keys
(
$parseOutput
[
'MESSAGES'
]
);
$actual
=
$cache
->
getKeys
();
$this
->
assertSame
(
$expected
,
$actual
,
'Cache should return correct keys in same order'
);
$expected
=
$parseOutput
[
'MESSAGES'
][
'b-message'
];
$actual
=
$cache
->
get
(
'b-message'
);
$this
->
assertSame
(
$expected
,
$actual
,
'Cache should return correct message content'
);
$expected
=
$parseOutput
[
'AUTHORS'
];
$actual
=
$cache
->
getAuthors
();
$this
->
assertSame
(
$expected
,
$actual
,
'Cache should return correct authors'
);
$expected
=
$parseOutput
[
'EXTRA'
];
$actual
=
$cache
->
getExtra
();
$this
->
assertSame
(
$expected
,
$actual
,
'Cache should return extra data'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 19:53 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4a/ef/25c996f8f522a7656745a26c8da0
Default Alt Text
MessageGroupCacheTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment