From 5d572e7a6d479ef68ee92c9d67e2e9465174fb4c Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 20 Jan 2021 14:18:04 -0600 Subject: [PATCH] formatting --- src/Illuminate/Queue/Events/JobQueued.php | 25 +++++++++++++++----- src/Illuminate/Queue/Queue.php | 28 +++++++++++------------ tests/Queue/RedisQueueIntegrationTest.php | 2 +- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/Illuminate/Queue/Events/JobQueued.php b/src/Illuminate/Queue/Events/JobQueued.php index 4568cd922fb0..c91d14095963 100644 --- a/src/Illuminate/Queue/Events/JobQueued.php +++ b/src/Illuminate/Queue/Events/JobQueued.php @@ -5,25 +5,38 @@ class JobQueued { /** + * The connection name. + * + * @var string + */ + public $connectionName; + + /** + * The job ID. + * * @var string|int|null */ - public $jobId; + public $id; /** - * @var string|object + * The job instance. + * + * @var \Closure|string|object */ public $job; /** - * JobQueued constructor. + * Create a new event instance. * - * @param string|int|null $jobId + * @param string $connectionName + * @param string|int|null $id * @param \Closure|string|object $job * @return void */ - public function __construct($jobId, $job) + public function __construct($connectionName, $id, $job) { - $this->jobId = $jobId; + $this->connectionName = $connectionName; + $this->id = $id; $this->job = $job; } } diff --git a/src/Illuminate/Queue/Queue.php b/src/Illuminate/Queue/Queue.php index bfe8baec8507..f036f2a871c5 100755 --- a/src/Illuminate/Queue/Queue.php +++ b/src/Illuminate/Queue/Queue.php @@ -317,6 +317,20 @@ protected function shouldDispatchAfterCommit($job) return false; } + /** + * Raise the job queued event. + * + * @param string|int|null $jobId + * @param \Closure|string|object $job + * @return void + */ + protected function raiseJobQueuedEvent($jobId, $job) + { + if ($this->container->bound('events')) { + $this->container['events']->dispatch(new JobQueued($this->connectionName, $jobId, $job)); + } + } + /** * Get the connection name for the queue. * @@ -350,18 +364,4 @@ public function setContainer(Container $container) { $this->container = $container; } - - /** - * Raise the job queued event. - * - * @param string|int|null $jobId - * @param \Closure|string|object $job - * @return void - */ - protected function raiseJobQueuedEvent($jobId, $job) - { - if ($this->container->bound('events')) { - $this->container['events']->dispatch(new JobQueued($jobId, $job)); - } - } } diff --git a/tests/Queue/RedisQueueIntegrationTest.php b/tests/Queue/RedisQueueIntegrationTest.php index b0a6a498f99c..5fbad9311dd4 100644 --- a/tests/Queue/RedisQueueIntegrationTest.php +++ b/tests/Queue/RedisQueueIntegrationTest.php @@ -477,7 +477,7 @@ public function testPushJobQueuedEvent($driver) $events = m::mock(Dispatcher::class); $events->shouldReceive('dispatch')->withArgs(function (JobQueued $jobQueued) { $this->assertInstanceOf(RedisQueueIntegrationTestJob::class, $jobQueued->job); - $this->assertIsString(RedisQueueIntegrationTestJob::class, $jobQueued->jobId); + $this->assertIsString(RedisQueueIntegrationTestJob::class, $jobQueued->id); return true; })->andReturnNull()->once();