Skip to content

Commit 3f5d370

Browse files
[8.x] Add assertBatchCount (#40217)
* Add assertBatchCount * Add doc-block to facade * Fix doc-block * Update BusFake.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent f55fee2 commit 3f5d370

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/Illuminate/Support/Facades/Bus.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* @method static void assertDispatchedAfterResponseTimes(string $command, int $times = 1)
2525
* @method static void assertNotDispatchedAfterResponse(string|\Closure $command, callable $callback = null)
2626
* @method static void assertBatched(callable $callback)
27+
* @method static void assertBatchCount(int $count)
2728
* @method static void assertChained(array $expectedChain)
2829
* @method static void assertDispatchedSync(string|\Closure $command, callable $callback = null)
2930
* @method static void assertDispatchedSyncTimes(string $command, int $times = 1)

src/Illuminate/Support/Testing/Fakes/BusFake.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,19 @@ public function assertBatched(callable $callback)
413413
);
414414
}
415415

416+
/**
417+
* Assert the number of batches that have been dispatched.
418+
*
419+
* @param int $count
420+
* @return void
421+
*/
422+
public function assertBatchCount($count)
423+
{
424+
PHPUnit::assertCount(
425+
$count, $this->batches,
426+
);
427+
}
428+
416429
/**
417430
* Get all of the jobs matching a truth-test callback.
418431
*

0 commit comments

Comments
 (0)