mirror of
https://github.com/archtechx/jobpipeline.git
synced 2025-12-16 06:44:04 +00:00
test: add tests
This commit is contained in:
parent
85e7d8a6b9
commit
ebeef52b4b
2 changed files with 49 additions and 2 deletions
|
|
@ -61,13 +61,15 @@ class JobPipeline implements ShouldQueue
|
|||
{
|
||||
foreach ($this->jobs as $job) {
|
||||
if (is_string($job)) {
|
||||
$job = [new $job(...$this->passable), 'handle'];
|
||||
if (!str_contains($job, '@')) {
|
||||
$job = [new $job(...$this->passable), 'handle'];
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$result = app()->call($job, $this->passable);
|
||||
} catch (Throwable $exception) {
|
||||
if (method_exists(get_class($job[0]), 'failed')) {
|
||||
if (is_array($job) && method_exists(get_class($job[0]), 'failed')) {
|
||||
call_user_func_array([$job[0], 'failed'], [$exception]);
|
||||
} else {
|
||||
throw $exception;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue