Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4075210
ClearInterwikiCacheTest.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
ClearInterwikiCacheTest.php
View Options
<?php
namespace
MediaWiki\Tests\Maintenance
;
use
ClearInterwikiCache
;
use
MediaWiki\Interwiki\InterwikiLookup
;
/**
* @covers \ClearInterwikiCache
* @group Database
* @author Dreamy Jazz
*/
class
ClearInterwikiCacheTest
extends
MaintenanceBaseTestCase
{
protected
function
getMaintenanceClass
()
{
return
ClearInterwikiCache
::
class
;
}
public
function
testExecute
()
{
// Insert some testing interwiki table rows
$this
->
getDb
()->
newInsertQueryBuilder
()
->
insertInto
(
'interwiki'
)
->
rows
(
[
[
'iw_prefix'
=>
'en'
,
'iw_url'
=>
'test$1'
,
'iw_api'
=>
'testapi$1'
,
'iw_wikiid'
=>
'enwiki'
,
'iw_local'
=>
0
,
'iw_trans'
=>
0
,
],
[
'iw_prefix'
=>
'de'
,
'iw_url'
=>
'de.test$1'
,
'iw_api'
=>
'de.testapi$1'
,
'iw_wikiid'
=>
'dewiki'
,
'iw_local'
=>
0
,
'iw_trans'
=>
0
,
],
]
)
->
execute
();
// Mock that the InterwikiLookup::invalidateCache method is called.
$this
->
setService
(
'InterwikiLookup'
,
function
()
{
$mockInterwikiLookup
=
$this
->
createMock
(
InterwikiLookup
::
class
);
$mockInterwikiLookup
->
expects
(
$this
->
exactly
(
2
)
)
->
method
(
'invalidateCache'
)
->
willReturnCallback
(
function
(
$prefix
)
{
$this
->
assertContains
(
$prefix
,
[
'en'
,
'de'
]
);
}
);
return
$mockInterwikiLookup
;
}
);
$this
->
maintenance
->
execute
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 17 2026, 17:56 (10 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c1/c5/92d9a5bd0a90a5ebfbf222ad4dc2
Default Alt Text
ClearInterwikiCacheTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment