You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[12.x] Add the assertClosureNotPushed method (#10648)
* Add the assertClosureNotPushed method and an example, revise some wording.
* Update queues.md
---------
Co-authored-by: Taylor Otwell <[email protected]>
Copy file name to clipboardExpand all lines: queues.md
+15-3Lines changed: 15 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2488,9 +2488,12 @@ test('orders can be shipped', function () {
2488
2488
// Assert a job was not pushed...
2489
2489
Queue::assertNotPushed(AnotherJob::class);
2490
2490
2491
-
// Assert that a Closure was pushed to the queue...
2491
+
// Assert that a closure was pushed to the queue...
2492
2492
Queue::assertClosurePushed();
2493
2493
2494
+
// Assert that a closure was not pushed...
2495
+
Queue::assertClosureNotPushed();
2496
+
2494
2497
// Assert the total number of jobs that were pushed...
2495
2498
Queue::assertCount(3);
2496
2499
});
@@ -2527,21 +2530,30 @@ class ExampleTest extends TestCase
2527
2530
// Assert a job was not pushed...
2528
2531
Queue::assertNotPushed(AnotherJob::class);
2529
2532
2530
-
// Assert that a Closure was pushed to the queue...
2533
+
// Assert that a closure was pushed to the queue...
2531
2534
Queue::assertClosurePushed();
2532
2535
2536
+
// Assert that a closure was not pushed...
2537
+
Queue::assertClosureNotPushed();
2538
+
2533
2539
// Assert the total number of jobs that were pushed...
2534
2540
Queue::assertCount(3);
2535
2541
}
2536
2542
}
2537
2543
```
2538
2544
2539
-
You may pass a closure to the `assertPushed`or `assertNotPushed` methods in order to assert that a job was pushed that passes a given "truth test". If at least one job was pushed that passes the given truth test then the assertion will be successful:
2545
+
You may pass a closure to the `assertPushed`, `assertNotPushed`, `assertClosurePushed`, or `assertClosureNotPushed` methods in order to assert that a job was pushed that passes a given "truth test". If at least one job was pushed that passes the given truth test then the assertion will be successful:
2540
2546
2541
2547
```php
2548
+
use Illuminate\Queue\CallQueuedClosure;
2549
+
2542
2550
Queue::assertPushed(function (ShipOrder $job) use ($order) {
0 commit comments