From ed6bd2eaddafddd6be05c7144114c78803f4c1a7 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Wed, 9 Dec 2020 16:58:18 +0200 Subject: [PATCH] fix tests --- src/Illuminate/Queue/Queue.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index b6f87b969ec7..b8f525918098 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -278,7 +278,7 @@ protected function enqueueUsing($job, $payload, $queue, $delay, $callback) if ($this->shouldDispatchAfterCommit($job) && $this->container->bound('db.transactions')) { return $this->container->make('db.transactions')->addCallback( - $callback + $this->afterCommitCallback($payload, $queue, $delay, $callback) ); } @@ -304,6 +304,22 @@ protected function shouldDispatchAfterCommit($job) return false; } + /** + * Create the after commit callback. + * + * @param string $payload + * @param string $queue + * @param \DateTimeInterface|\DateInterval|int|null $delay + * @param callable $callback + * @return callable + */ + protected function afterCommitCallback($payload, $queue, $delay, $callback) + { + return function () use ($delay, $queue, $payload, $callback) { + return $callback($payload, $queue, $delay); + }; + } + /** * Get the connection name for the queue. *