Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
FlushUtterancesFromStoreByPageIdJobQueue
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 queueJob
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\Wikispeech\Utterance;
4
5/**
6 * @file
7 * @ingroup Extensions
8 * @license GPL-2.0-or-later
9 */
10
11use MediaWiki\MediaWikiServices;
12use Title;
13
14/**
15 * This used to be a single static method located in
16 * {@link FlushUtterancesFromStoreByPageIdJob}
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::flushUtterancesByPage()
22 * @see FlushUtterancesFromStoreByPageIdJob
23 *
24 * @since 0.1.7
25 */
26class FlushUtterancesFromStoreByPageIdJobQueue {
27    /**
28     * Queues a job.
29     *
30     * @since 0.1.7
31     * @param int $pageId
32     */
33    public function queueJob( $pageId ) {
34        $jobQueueGroup = MediaWikiServices::getInstance()->getJobQueueGroup();
35        $jobQueueGroup->push(
36            new FlushUtterancesFromStoreByPageIdJob(
37                Title::newMainPage(),
38                [ 'pageId' => $pageId ]
39            )
40        );
41    }
42}