| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace Tests\Unit\Jobs;
- use App\Jobs\GenerateFilesPack;
- use App\Models\Order;
- use Illuminate\Support\Facades\Bus;
- use Illuminate\Support\Facades\Queue;
- use Mockery;
- use Tests\TestCase;
- class GenerateFilesPackTest extends TestCase
- {
- protected function tearDown(): void
- {
- Mockery::close();
- parent::tearDown();
- }
- public function test_job_can_be_dispatched(): void
- {
- Bus::fake();
- $order = Mockery::mock(Order::class);
- GenerateFilesPack::dispatch($order, collect([]), 1);
- Bus::assertDispatched(GenerateFilesPack::class);
- }
- public function test_job_is_queued_via_queue_fake(): void
- {
- Queue::fake();
- $order = Mockery::mock(Order::class);
- GenerateFilesPack::dispatch($order, collect([]), 1);
- Queue::assertPushed(GenerateFilesPack::class);
- }
- public function test_job_dispatched_with_custom_name(): void
- {
- Bus::fake();
- $order = Mockery::mock(Order::class);
- GenerateFilesPack::dispatch($order, collect([]), 1, 'documents');
- Bus::assertDispatched(GenerateFilesPack::class);
- }
- public function test_job_not_dispatched_without_dispatch_call(): void
- {
- Bus::fake();
- Bus::assertNotDispatched(GenerateFilesPack::class);
- }
- }
|