Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5988766
FileBackendGroupIntegrationTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
FileBackendGroupIntegrationTest.php
View Options
<?php
use
MediaWiki\FileBackend\FileBackendGroup
;
use
MediaWiki\FileBackend\LockManager\LockManagerGroupFactory
;
use
MediaWiki\MainConfigNames
;
use
MediaWiki\Tests\Unit\DummyServicesTrait
;
use
MediaWiki\WikiMap\WikiMap
;
use
Wikimedia\ObjectCache\EmptyBagOStuff
;
/**
* @covers \MediaWiki\FileBackend\FileBackendGroup
*/
class
FileBackendGroupIntegrationTest
extends
MediaWikiIntegrationTestCase
{
use
FileBackendGroupTestTrait
;
use
DummyServicesTrait
;
private
static
function
getWikiID
()
{
return
WikiMap
::
getCurrentWikiId
();
}
private
function
getLockManagerGroupFactory
(
$domain
):
LockManagerGroupFactory
{
return
$this
->
getServiceContainer
()->
getLockManagerGroupFactory
();
}
private
function
newObj
(
array
$options
=
[]
):
FileBackendGroup
{
$globals
=
[
MainConfigNames
::
DirectoryMode
,
MainConfigNames
::
FileBackends
,
MainConfigNames
::
ForeignFileRepos
,
MainConfigNames
::
LocalFileRepo
,
];
foreach
(
$globals
as
$global
)
{
$this
->
overrideConfigValue
(
$global
,
$options
[
$global
]
??
self
::
getDefaultOptions
()[
$global
]
);
}
$serviceMembers
=
[
'readOnlyMode'
=>
'ReadOnlyMode'
,
'srvCache'
=>
'LocalServerObjectCache'
,
'mimeAnalyzer'
=>
'MimeAnalyzer'
,
'lmgFactory'
=>
'LockManagerGroupFactory'
,
'tmpFileFactory'
=>
'TempFSFileFactory'
,
];
foreach
(
$serviceMembers
as
$key
=>
$name
)
{
if
(
isset
(
$options
[
$key
]
)
)
{
if
(
$key
===
'readOnlyMode'
)
{
$this
->
setService
(
$name
,
$this
->
getDummyReadOnlyMode
(
$options
[
$key
]
)
);
}
else
{
$this
->
setService
(
$name
,
$options
[
$key
]
);
}
}
}
$this
->
assertSame
(
[],
array_diff
(
array_keys
(
$options
),
$globals
,
array_keys
(
$serviceMembers
)
)
);
$services
=
$this
->
getServiceContainer
();
$obj
=
$services
->
getFileBackendGroup
();
foreach
(
$serviceMembers
as
$key
=>
$name
)
{
if
(
$key
===
'readOnlyMode'
||
$key
===
'mimeAnalyzer'
)
{
continue
;
}
$this
->
$key
=
$services
->
getService
(
$name
);
if
(
$key
===
'srvCache'
&&
$this
->
$key
instanceof
EmptyBagOStuff
)
{
// ServiceWiring will have created its own HashBagOStuff that we don't have a
// reference to. Set null instead.
$this
->
srvCache
=
null
;
}
}
return
$obj
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Oct 4, 00:54 (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5a/51/5e842b497d3ddde65d5cfb6dcb1a
Default Alt Text
FileBackendGroupIntegrationTest.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment