ExportMafJobTest.php 958 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Tests\Unit\Jobs;
  3. use App\Jobs\ExportMafJob;
  4. use Illuminate\Support\Facades\Bus;
  5. use Illuminate\Support\Facades\Queue;
  6. use Tests\TestCase;
  7. class ExportMafJobTest extends TestCase
  8. {
  9. public function test_job_can_be_dispatched(): void
  10. {
  11. Bus::fake();
  12. ExportMafJob::dispatch(1, ['year' => 2026]);
  13. Bus::assertDispatched(ExportMafJob::class);
  14. }
  15. public function test_job_is_queued_via_queue_fake(): void
  16. {
  17. Queue::fake();
  18. ExportMafJob::dispatch(1, ['year' => 2026]);
  19. Queue::assertPushed(ExportMafJob::class);
  20. }
  21. public function test_job_dispatched_without_year_filter(): void
  22. {
  23. Bus::fake();
  24. ExportMafJob::dispatch(1, []);
  25. Bus::assertDispatched(ExportMafJob::class);
  26. }
  27. public function test_job_not_dispatched_without_dispatch_call(): void
  28. {
  29. Bus::fake();
  30. Bus::assertNotDispatched(ExportMafJob::class);
  31. }
  32. }