Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4106974
MessageGroupLoaderTest.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
MessageGroupLoaderTest.php
View Options
<?php
use
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups
;
/**
* @covers \MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups
* @group Database
*/
class
MessageGroupLoaderTest
extends
MediaWikiIntegrationTestCase
{
use
MessageGroupTestTrait
;
/** @var MockCacheMessageGroupLoader */
protected
$cacheLoaderMock
;
protected
function
setUp
():
void
{
parent
::
setUp
();
$config
=
new
MessageGroupTestConfig
();
$config
->
groupInitLoaders
=
[
[
$this
,
'registerLoader'
]
];
$config
->
skipMessageIndexRebuild
=
true
;
$this
->
cacheLoaderMock
=
$this
->
createMock
(
MockCacheMessageGroupLoader
::
class
);
$this
->
setupGroupTestEnvironmentWithConfig
(
$this
,
$config
);
}
public
function
registerLoader
(
array
&
$groupLoader
,
array
$deps
)
{
$groupLoader
[]
=
$this
->
cacheLoaderMock
;
}
public
function
testGroupLoaderGetGroups
()
{
$testGroup
=
new
WikiMessageGroup
(
'testgroup'
,
'hello'
);
$this
->
cacheLoaderMock
->
expects
(
$this
->
once
()
)
->
method
(
'recache'
)
->
willReturn
(
[
$testGroup
]
);
MessageGroups
::
singleton
()->
recache
();
MessageGroups
::
singleton
()->
clearProcessCache
();
$this
->
cacheLoaderMock
->
expects
(
$this
->
once
()
)
->
method
(
'getGroups'
)
->
willReturn
(
[
$testGroup
]
);
$groups
=
MessageGroups
::
singleton
()->
getGroups
();
$this
->
assertCount
(
1
,
$groups
,
'the message group returned by the loader is present'
);
$this
->
assertEquals
(
'testgroup'
,
$groups
[
0
]->
getId
(),
'the id of the message group '
.
'returned by the loader is present in the groups'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 19:49 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ff/b3/da94f504fa0e1c37da1a651619aa
Default Alt Text
MessageGroupLoaderTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment