Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 20, 2021
1 parent 8eaec03 commit 5d572e7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 21 deletions.
25 changes: 19 additions & 6 deletions src/Illuminate/Queue/Events/JobQueued.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
28 changes: 14 additions & 14 deletions src/Illuminate/Queue/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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));
}
}
}
2 changes: 1 addition & 1 deletion tests/Queue/RedisQueueIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 5d572e7

Please sign in to comment.