Skip to content

Commit

Permalink
[10.x] Fix BusFake::assertChained() for a single job (#47832)
Browse files Browse the repository at this point in the history
  • Loading branch information
gehrisandro committed Jul 25, 2023
1 parent 55ccc3a commit 0965fc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/Illuminate/Support/Testing/Fakes/BusFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions tests/Support/SupportTestingBusFakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0965fc1

Please sign in to comment.