Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5982871
LocalisationCacheTest.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
LocalisationCacheTest.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Tests\Unit\Language
;
use
LocalisationCache
;
use
MediaWikiUnitTestCase
;
use
Wikimedia\TestingAccessWrapper
;
/**
* @covers \LocalisationCache
* @group Language
*/
class
LocalisationCacheTest
extends
MediaWikiUnitTestCase
{
public
function
testAllKeysSplitIntoCoreOnlyAndNonCoreOnly
():
void
{
$coreOnlyKeys
=
TestingAccessWrapper
::
constant
(
LocalisationCache
::
class
,
'CORE_ONLY_KEYS'
);
$allExceptCoreOnlyKeys
=
TestingAccessWrapper
::
constant
(
LocalisationCache
::
class
,
'ALL_EXCEPT_CORE_ONLY_KEYS'
);
$this
->
assertSame
(
[],
array_diff
(
$coreOnlyKeys
,
LocalisationCache
::
ALL_KEYS
),
'core-only keys must be subset of all keys'
);
$this
->
assertSame
(
[],
array_diff
(
$allExceptCoreOnlyKeys
,
LocalisationCache
::
ALL_KEYS
),
'keys that are not core-only must be subset of all keys'
);
$this
->
assertSame
(
[],
array_intersect
(
$coreOnlyKeys
,
$allExceptCoreOnlyKeys
),
'core-only and other keys must not overlap'
);
$this
->
assertSame
(
[],
array_diff
(
LocalisationCache
::
ALL_KEYS
,
array_merge
(
$coreOnlyKeys
,
$allExceptCoreOnlyKeys
)
),
'core-only keys + all keys except them must contain all keys'
);
}
public
function
testCoreOnlyKeysNotMergeable
():
void
{
$coreOnlyKeys
=
TestingAccessWrapper
::
constant
(
LocalisationCache
::
class
,
'CORE_ONLY_KEYS'
);
$lc
=
TestingAccessWrapper
::
newFromClass
(
LocalisationCache
::
class
);
foreach
(
$coreOnlyKeys
as
$key
)
{
$this
->
assertFalse
(
$lc
->
isMergeableKey
(
$key
),
'it does not make sense for core-only keys to be mergeable'
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 22:35 (1 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b7/03/f3605cb4c924cbd7133e21316334
Default Alt Text
LocalisationCacheTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment