Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4009201
MockWikiMapTrait.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
665 B
Referenced Files
None
Subscribers
None
MockWikiMapTrait.php
View Options
<?php
namespace
MediaWiki\Tests
;
use
MediaWiki\Site\HashSiteStore
;
use
MediaWiki\Site\MediaWikiSite
;
use
MediaWiki\WikiMap\WikiMap
;
/**
* Ensure WikiMap::getWiki returns a MediaWikiSite for the current wiki, for tests.
*
* @since 1.44
*/
trait
MockWikiMapTrait
{
/**
* Override the SiteLookup service to include the current site.
*
* @return void
*/
private
function
mockWikiMap
()
{
$currentSite
=
new
MediaWikiSite
();
$currentSite
->
setGlobalId
(
WikiMap
::
getCurrentWikiId
()
);
$currentSite
->
setPath
(
MediaWikiSite
::
PATH_PAGE
,
'https://example.com/wiki/$1'
);
$this
->
setService
(
'SiteLookup'
,
new
HashSiteStore
(
[
$currentSite
]
)
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 14 2026, 10:49 (14 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6e/9e/3546d5ac1952d8b5f2877f9bf684
Default Alt Text
MockWikiMapTrait.php (665 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment