Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * ServiceWiring files for VisualEditor. |
| 5 | * |
| 6 | * @file |
| 7 | * @ingroup Extensions |
| 8 | * @copyright 2011-2021 VisualEditor Team and others; see AUTHORS.txt |
| 9 | * @license MIT |
| 10 | */ |
| 11 | |
| 12 | namespace MediaWiki\Extension\VisualEditor; |
| 13 | |
| 14 | use MediaWiki\Config\ServiceOptions; |
| 15 | use MediaWiki\Extension\VisualEditor\EditCheck\EditSuggestionCounts\EditSuggestionCountsConfig; |
| 16 | use MediaWiki\Extension\VisualEditor\Services\VisualEditorAvailabilityLookup; |
| 17 | use MediaWiki\MediaWikiServices; |
| 18 | |
| 19 | // PHP unit does not understand code coverage for this file |
| 20 | // as the @covers annotation cannot cover a specific file |
| 21 | // This is fully tested in ServiceWiringTest.php |
| 22 | // @codeCoverageIgnoreStart |
| 23 | |
| 24 | return [ |
| 25 | VisualEditorParsoidClientFactory::SERVICE_NAME => static function ( |
| 26 | MediaWikiServices $services |
| 27 | ): VisualEditorParsoidClientFactory { |
| 28 | return new VisualEditorParsoidClientFactory( $services->getPageRestHelperFactory() ); |
| 29 | }, |
| 30 | VisualEditorAvailabilityLookup::SERVICE_NAME => static function ( |
| 31 | MediaWikiServices $services |
| 32 | ) { |
| 33 | return new VisualEditorAvailabilityLookup( |
| 34 | new ServiceOptions( |
| 35 | VisualEditorAvailabilityLookup::CONSTRUCTOR_OPTIONS, |
| 36 | $services->getMainConfig() |
| 37 | ), |
| 38 | $services->getNamespaceInfo(), |
| 39 | $services->getExtensionRegistry(), |
| 40 | $services->getUserOptionsLookup() |
| 41 | ); |
| 42 | }, |
| 43 | |
| 44 | // PoC: edit-suggestions-specific LAC precompute. Lives in VisualEditor for now; the |
| 45 | // generic LAC cache-warming approach will move to a proper home (TBD) later. See |
| 46 | // https://phabricator.wikimedia.org/T432733. |
| 47 | EditSuggestionCountsConfig::SERVICE_NAME => static function ( |
| 48 | MediaWikiServices $services |
| 49 | ): EditSuggestionCountsConfig { |
| 50 | return new EditSuggestionCountsConfig( |
| 51 | $services->getMainConfig()->get( 'VisualEditorEditSuggestionCounts' ) |
| 52 | ); |
| 53 | }, |
| 54 | ]; |
| 55 | |
| 56 | // @codeCoverageIgnoreEnd |