From 0965fc194836b2d1526314717bd2c88afd450e1b Mon Sep 17 00:00:00 2001 From: Sandro Gehri Date: Tue, 25 Jul 2023 21:33:34 +0200 Subject: [PATCH] [10.x] Fix BusFake::assertChained() for a single job (#47832) --- src/Illuminate/Support/Testing/Fakes/BusFake.php | 5 ----- tests/Support/SupportTestingBusFakeTest.php | 8 ++++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Support/Testing/Fakes/BusFake.php b/src/Illuminate/Support/Testing/Fakes/BusFake.php index 090a74309dbd..6061344730d8 100644 --- a/src/Illuminate/Support/Testing/Fakes/BusFake.php +++ b/src/Illuminate/Support/Testing/Fakes/BusFake.php @@ -341,11 +341,6 @@ public function assertChained(array $expectedChain) "The expected [{$command}] job was not dispatched." ); - PHPUnit::assertTrue( - collect($expectedChain)->isNotEmpty(), - 'The expected chain can not be empty.' - ); - $this->isChainOfObjects($expectedChain) ? $this->assertDispatchedWithChainOfObjects($command, $expectedChain, $callback) : $this->assertDispatchedWithChainOfClasses($command, $expectedChain, $callback); diff --git a/tests/Support/SupportTestingBusFakeTest.php b/tests/Support/SupportTestingBusFakeTest.php index cc23b62b824f..4ea6cdd9b19d 100644 --- a/tests/Support/SupportTestingBusFakeTest.php +++ b/tests/Support/SupportTestingBusFakeTest.php @@ -466,6 +466,14 @@ public function testAssertNothingDispatched() public function testAssertChained() { + $this->fake->chain([ + new ChainedJobStub, + ])->dispatch(); + + $this->fake->assertChained([ + ChainedJobStub::class, + ]); + $this->fake->chain([ new ChainedJobStub, new OtherBusJobStub,