2026, '--chunk' => 250, ]); $this->assertSame(0, $exitCode); Queue::assertPushed(BackfillPaidOrderStatusesJob::class); } public function test_command_can_run_backfill_synchronously(): void { $order = Order::factory()->create([ 'year' => 2026, 'order_status_id' => Order::STATUS_HANDED_OVER, ]); ProductSKU::factory()->forOrder($order)->create([ 'year' => 2026, 'statement_number' => 'ST-1', 'upd_number' => 'UPD-1', ]); $exitCode = Artisan::call('orders:backfill-paid-statuses', [ '--year' => 2026, '--sync' => true, ]); $this->assertSame(0, $exitCode); $this->assertSame(Order::STATUS_PAID, $order->refresh()->order_status_id); } public function test_command_fails_when_chunk_size_is_invalid(): void { Queue::fake(); $exitCode = Artisan::call('orders:backfill-paid-statuses', [ '--chunk' => 0, ]); $this->assertSame(1, $exitCode); Queue::assertNothingPushed(); } }