Skip to content

Commit

Permalink
[5.6] Queue::bulk() fake now properly pushes expected jobs (#23294)
Browse files Browse the repository at this point in the history
* bulk() now properly pushes expected jobs

* Now also passes queue onto the fake

* Added tests to assert bulk() actually pushes jobs to the queue

* StyleCI adjustment
  • Loading branch information
bkuhl authored and taylorotwell committed Feb 26, 2018
1 parent 2d1364d commit 894492d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Support/Testing/Fakes/QueueFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ public function pop($queue = null)
*/
public function bulk($jobs, $data = '', $queue = null)
{
foreach ($this->jobs as $job) {
$this->push($job);
foreach ($jobs as $job) {
$this->push($job, $data, $queue);
}
}

Expand Down
14 changes: 14 additions & 0 deletions tests/Support/SupportTestingQueueFakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ public function testAssertNothingPushed()
$this->assertThat($e, new ExceptionMessage('Jobs were pushed unexpectedly.'));
}
}

public function testAssertPushedUsingBulk()
{
$this->fake->assertNothingPushed();

$queue = 'my-test-queue';
$this->fake->bulk([
$this->job,
new JobStub(),
], null, $queue);

$this->fake->assertPushedOn($queue, JobStub::class);
$this->fake->assertPushed(JobStub::class, 2);
}
}

class JobStub
Expand Down

0 comments on commit 894492d

Please sign in to comment.