-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from markhuot/queue-docs
Queue docs
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Queue Jobs | ||
|
||
Any `Sync` queue jobs are automatically run at the end of each test. Essentially the equivilant of, | ||
|
||
```php | ||
it('runs queues', function() { | ||
mock(UpdateSearchIndex::class) | ||
->shouldReceive('execute') | ||
->once(); | ||
|
||
// Act and perform your test | ||
Entry::factory()->create(); | ||
|
||
// This is run implicitely for you, as the very last step | ||
// Craft::$app->queue->run(); | ||
}); | ||
``` | ||
|
||
This test confirms that when an entry is created the `UpdateSearchIndex` job is run. You could just as easily test that a custom action or custom listener is run when an entry matching certain conditions is run. |