mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-13 17:56:55 +00:00
3d0c5b1cc3
Changes: - removed ugly PopupsContext::getInstance - removed ugly PopupsContextTestWrapper helper - defined all services inside ServiceWirings - fixed unit tests to test classes directly or use MediawikiServices Change-Id: Ie27e28bb07aebe01014848c290369b1b1f098e9b
45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
use MediaWiki\MediaWikiServices;
|
|
use Popups\PopupsContext;
|
|
use Popups\PopupsGadgetsIntegration;
|
|
use Popups\EventLogging\EventLoggerFactory;
|
|
use Popups\UserPreferencesChangeHandler;
|
|
use \MediaWiki\Logger\LoggerFactory;
|
|
|
|
return [
|
|
'Popups.Config' => function ( MediaWikiServices $services ) {
|
|
return $services->getService( 'ConfigFactory' )
|
|
->makeConfig( PopupsContext::EXTENSION_NAME );
|
|
},
|
|
'Popups.GadgetsIntegration' => function ( MediaWikiServices $services ) {
|
|
return new PopupsGadgetsIntegration(
|
|
$services->getService( 'Popups.Config' ),
|
|
ExtensionRegistry::getInstance()
|
|
);
|
|
},
|
|
'Popups.EventLogger' => function ( MediaWikiServices $serivces ) {
|
|
$factory = new EventLoggerFactory(
|
|
$serivces->getService( 'Popups.Config' ),
|
|
ExtensionRegistry::getInstance()
|
|
);
|
|
return $factory->get();
|
|
},
|
|
'Popups.UserPreferencesChangeHandler' => function ( MediaWikiServices $services ) {
|
|
return new UserPreferencesChangeHandler(
|
|
$services->getService( 'Popups.Context' )
|
|
);
|
|
},
|
|
'Popups.Logger' => function ( MediaWikiServices $services ) {
|
|
return LoggerFactory::getInstance( PopupsContext::LOGGER_CHANNEL );
|
|
},
|
|
'Popups.Context' => function ( MediaWikiServices $services ) {
|
|
return new PopupsContext(
|
|
$services->getService( 'Popups.Config' ),
|
|
ExtensionRegistry::getInstance(),
|
|
$services->getService( 'Popups.GadgetsIntegration' ),
|
|
$services->getService( 'Popups.EventLogger' )
|
|
);
|
|
}
|
|
];
|