Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| FlushUtterancesFromStoreByLanguageAndVoiceJobQueue | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| queueJob | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Wikispeech\Utterance; |
| 4 | |
| 5 | /** |
| 6 | * @file |
| 7 | * @ingroup Extensions |
| 8 | * @license GPL-2.0-or-later |
| 9 | */ |
| 10 | |
| 11 | use MediaWiki\MediaWikiServices; |
| 12 | use Mediawiki\Title\Title; |
| 13 | |
| 14 | /** |
| 15 | * This used to be a single static method located in |
| 16 | * {@link FlushUtterancesFromStoreByLanguageAndVoiceJob} |
| 17 | * but due to mocking not allowed in static scope, this had to be refactored |
| 18 | * to this new class. Feel free to suggest better solutions that can replace |
| 19 | * this method. |
| 20 | * |
| 21 | * @see UtteranceStore::flushUtterancesByLanguageAndVoice() |
| 22 | * @see FlushUtterancesFromStoreByLanguageAndVoiceJob |
| 23 | * |
| 24 | * @since 0.1.7 |
| 25 | */ |
| 26 | class FlushUtterancesFromStoreByLanguageAndVoiceJobQueue { |
| 27 | |
| 28 | /** |
| 29 | * Queues a job. |
| 30 | * |
| 31 | * @since 0.1.7 |
| 32 | * @param string $language |
| 33 | * @param string|null $voice |
| 34 | */ |
| 35 | public function queueJob( $language, $voice = null ) { |
| 36 | $jobQueueGroup = MediaWikiServices::getInstance()->getJobQueueGroup(); |
| 37 | $jobQueueGroup->push( |
| 38 | new FlushUtterancesFromStoreByLanguageAndVoiceJob( |
| 39 | Title::newMainPage(), |
| 40 | [ |
| 41 | 'language' => $language, |
| 42 | 'voice' => $voice |
| 43 | ], |
| 44 | MediaWikiServices::getInstance()->getService( 'Wikispeech.UtteranceStore' ) |
| 45 | ) |
| 46 | ); |
| 47 | } |
| 48 | } |