From 473c60cb37e67e6bb0818ddb30b94af71a9fe6e6 Mon Sep 17 00:00:00 2001 From: Vitor de Souza Date: Mon, 5 Mar 2018 09:15:20 -0300 Subject: [PATCH] QueueFake::bulk() properly pushes expected jobs --- src/Illuminate/Support/Testing/Fakes/QueueFake.php | 4 ++-- tests/Support/SupportTestingQueueFakeTest.php | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Support/Testing/Fakes/QueueFake.php b/src/Illuminate/Support/Testing/Fakes/QueueFake.php index 7428b871ad6f..66d191e90c95 100644 --- a/src/Illuminate/Support/Testing/Fakes/QueueFake.php +++ b/src/Illuminate/Support/Testing/Fakes/QueueFake.php @@ -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); } } diff --git a/tests/Support/SupportTestingQueueFakeTest.php b/tests/Support/SupportTestingQueueFakeTest.php index 1e14ff3af2f2..a41a8945214a 100644 --- a/tests/Support/SupportTestingQueueFakeTest.php +++ b/tests/Support/SupportTestingQueueFakeTest.php @@ -87,6 +87,18 @@ 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