Total Complexity | 5 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class QueuedJobsTestService extends QueuedJobService implements Resettable, TestOnly |
||
11 | { |
||
12 | private $jobs = []; |
||
13 | |||
14 | public function flushJobs(): void |
||
15 | { |
||
16 | $this->jobs = []; |
||
17 | } |
||
18 | |||
19 | public function getJobs(): array |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * Keep the jobs in-memory for unit test purposes (avoid writes and related actions) |
||
26 | * |
||
27 | * @param QueuedJob $job |
||
28 | * @param null $startAfter |
||
|
|||
29 | * @param null $userId |
||
30 | * @param null $queueName |
||
31 | * @return int |
||
32 | */ |
||
33 | public function queueJob(QueuedJob $job, $startAfter = null, $userId = null, $queueName = null) |
||
34 | { |
||
35 | $this->jobs[] = $job; |
||
36 | |||
37 | return 1; |
||
38 | } |
||
39 | |||
40 | public static function reset() |
||
41 | { |
||
42 | self::singleton()->flushJobs(); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Skip shutdown function actions |
||
47 | */ |
||
48 | public function onShutdown() |
||
50 | } |
||
51 | } |
||
52 |