File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 20
20
* @method static void assertDispatched(string|\Closure $command, callable|int $callback = null)
21
21
* @method static void assertDispatchedTimes(string $command, int $times = 1)
22
22
* @method static void assertNotDispatched(string|\Closure $command, callable|int $callback = null)
23
+ * @method static void assertNothingDispatched()
23
24
* @method static void assertDispatchedAfterResponse(string|\Closure $command, callable|int $callback = null)
24
25
* @method static void assertDispatchedAfterResponseTimes(string $command, int $times = 1)
25
26
* @method static void assertNotDispatchedAfterResponse(string|\Closure $command, callable $callback = null)
26
27
* @method static void assertBatched(callable $callback)
27
28
* @method static void assertBatchCount(int $count)
29
+ * @method static void assertNothingBatched()
28
30
* @method static void assertChained(array $expectedChain)
29
31
* @method static void assertDispatchedSync(string|\Closure $command, callable $callback = null)
30
32
* @method static void assertDispatchedSyncTimes(string $command, int $times = 1)
Original file line number Diff line number Diff line change @@ -422,6 +422,16 @@ public function assertBatchCount($count)
422
422
);
423
423
}
424
424
425
+ /**
426
+ * Assert that no batched jobs were dispatched.
427
+ *
428
+ * @return void
429
+ */
430
+ public function assertNothingBatched ()
431
+ {
432
+ PHPUnit::assertEmpty ($ this ->batches , 'Batched jobs were dispatched unexpectedly. ' );
433
+ }
434
+
425
435
/**
426
436
* Get all of the jobs matching a truth-test callback.
427
437
*
Original file line number Diff line number Diff line change @@ -454,6 +454,20 @@ function ($command) {
454
454
return $ job ->id === 1 ;
455
455
});
456
456
}
457
+
458
+ public function testAssertNothingBatched ()
459
+ {
460
+ $ this ->fake ->assertNothingBatched ();
461
+
462
+ $ this ->fake ->batch ([])->dispatch ();
463
+
464
+ try {
465
+ $ this ->fake ->assertNothingBatched ();
466
+ $ this ->fail ();
467
+ } catch (ExpectationFailedException $ e ) {
468
+ $ this ->assertThat ($ e , new ExceptionMessage ('Batched jobs were dispatched unexpectedly. ' ));
469
+ }
470
+ }
457
471
}
458
472
459
473
class BusJobStub
You can’t perform that action at this time.
0 commit comments