3 use MediaWiki\MediaWikiServices
;
6 * @coversDefaultClass FileBackendGroup
8 * @covers ::destroySingleton
10 class FileBackendGroupIntegrationTest
extends MediaWikiIntegrationTestCase
{
11 use FileBackendGroupTestTrait
;
13 private static function getWikiID() {
17 private function getLockManagerGroupFactory() {
18 return MediaWikiServices
::getInstance()->getLockManagerGroupFactory();
21 private function newObj( array $options = [] ) : FileBackendGroup
{
22 $globals = [ 'DirectoryMode', 'FileBackends', 'ForeignFileRepos', 'LocalFileRepo' ];
23 foreach ( $globals as $global ) {
25 "wg$global", $options[$global] ?? self
::getDefaultOptions()[$global] );
29 'configuredROMode' => 'ConfiguredReadOnlyMode',
30 'srvCache' => 'LocalServerObjectCache',
31 'wanCache' => 'MainWANObjectCache',
32 'mimeAnalyzer' => 'MimeAnalyzer',
33 'lmgFactory' => 'LockManagerGroupFactory',
34 'tmpFileFactory' => 'TempFSFileFactory',
37 foreach ( $serviceMembers as $key => $name ) {
38 if ( isset( $options[$key] ) ) {
39 $this->setService( $name, $options[$key] );
44 array_diff( array_keys( $options ), $globals, array_keys( $serviceMembers ) ) );
46 $this->resetServices();
47 FileBackendGroup
::destroySingleton();
49 $services = MediaWikiServices
::getInstance();
51 foreach ( $serviceMembers as $key => $name ) {
52 if ( $key === 'srvCache' ) {
53 $this->$key = ObjectCache
::getLocalServerInstance( 'hash' );
55 $this->$key = $services->getService( $name );
59 return FileBackendGroup
::singleton();