Skip to content

Commit

Permalink
Merge pull request #41 from markhuot/queue-docs
Browse files Browse the repository at this point in the history
Queue docs
  • Loading branch information
markhuot authored Nov 28, 2024
2 parents 4db8d10 + 7d7f5f7 commit 251ce8e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/queue.md
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.

0 comments on commit 251ce8e

Please sign in to comment.