From 815349ec8bacfa1dcaff170d650186a4b50ad9f3 Mon Sep 17 00:00:00 2001 From: Ben Kuhl Date: Wed, 18 Apr 2018 22:24:36 -0400 Subject: [PATCH] Queue fake now correctly counts the number of jobs --- src/Illuminate/Support/Testing/Fakes/QueueFake.php | 2 +- tests/Support/SupportTestingQueueFakeTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Support/Testing/Fakes/QueueFake.php b/src/Illuminate/Support/Testing/Fakes/QueueFake.php index 7cc36c3c8355..960a776eaea4 100644 --- a/src/Illuminate/Support/Testing/Fakes/QueueFake.php +++ b/src/Illuminate/Support/Testing/Fakes/QueueFake.php @@ -229,7 +229,7 @@ public function connection($value = null) */ public function size($queue = null) { - return 0; + return count($this->jobs); } /** diff --git a/tests/Support/SupportTestingQueueFakeTest.php b/tests/Support/SupportTestingQueueFakeTest.php index be3d0252d8ff..9b9fd40e815f 100644 --- a/tests/Support/SupportTestingQueueFakeTest.php +++ b/tests/Support/SupportTestingQueueFakeTest.php @@ -32,6 +32,15 @@ public function testAssertPushed() $this->fake->assertPushed(JobStub::class); } + public function testQueueSize() + { + $this->assertEquals(0, $this->fake->size()); + + $this->fake->push($this->job); + + $this->assertEquals(1, $this->fake->size()); + } + public function testAssertNotPushed() { $this->fake->assertNotPushed(JobStub::class);