Repository navigation
Expand file tree
/
Copy pathJobRecordFixture.php
More file actions
56 lines (52 loc) · 1.6 KB
/
Copy pathJobRecordFixture.php
File metadata and controls
56 lines (52 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
declare(strict_types=1);
namespace PHPForge\Debug\Tests\Support;
use PHPForge\Debug\Panel\Queue\JobRecord;
/**
* Builds queue lifecycle events for the Queue panel renderer tests.
*/
final class JobRecordFixture
{
/**
* Creates a queue lifecycle event, overriding only the fields a test cares about.
*
* @param array<string, mixed> $payloadFields Captured job payload fields.
*
* @return JobRecord Queue lifecycle event built from the defaults and the given overrides.
*/
public static function create(
string $eventType = 'push',
string $componentId = 'queue',
string $driverName = 'Sync',
string $driverClass = 'yii\\queue\\sync\\Queue',
bool $isAsync = false,
string $jobClass = 'app\\jobs\\HelloJob',
array $payloadFields = [],
float $time = 0.0,
string $jobId = '',
int|null $ttr = null,
int|null $delay = null,
int|null $priority = null,
int|null $attempt = null,
float|null $duration = null,
string $error = '',
): JobRecord {
return new JobRecord(
eventType: $eventType,
componentId: $componentId,
driverName: $driverName,
driverClass: $driverClass,
isAsync: $isAsync,
jobClass: $jobClass,
payloadFields: $payloadFields,
time: $time,
jobId: $jobId,
ttr: $ttr,
delay: $delay,
priority: $priority,
attempt: $attempt,
duration: $duration,
error: $error,
);
}
}