| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace Tests\Unit\Jobs;
- use App\Jobs\ExportOrdersJob;
- use Illuminate\Support\Facades\Bus;
- use Illuminate\Support\Facades\Queue;
- use Tests\TestCase;
- class ExportOrdersJobTest extends TestCase
- {
- public function test_job_can_be_dispatched(): void
- {
- Bus::fake();
- ExportOrdersJob::dispatch(collect([]), 1);
- Bus::assertDispatched(ExportOrdersJob::class);
- }
- public function test_job_dispatched_with_correct_user_id(): void
- {
- Bus::fake();
- ExportOrdersJob::dispatch(collect(['order1', 'order2']), 42);
- Bus::assertDispatched(ExportOrdersJob::class, function (ExportOrdersJob $job) {
- return true;
- });
- }
- public function test_job_is_queued_via_queue_fake(): void
- {
- Queue::fake();
- ExportOrdersJob::dispatch(collect([]), 1);
- Queue::assertPushed(ExportOrdersJob::class);
- }
- public function test_job_not_dispatched_without_dispatch_call(): void
- {
- Bus::fake();
- Bus::assertNotDispatched(ExportOrdersJob::class);
- }
- }
|