shouldReceive('findUsersWithMissedPayments')->once()->andReturn([]); $this->app->instance(PaymentMissedCheckService::class, $service); $this->artisan('payments:check-missed')->assertExitCode(0); } public function test_monthly_reminder_command_sends_to_email(): void { DB::table('users')->insert([ 'id' => 1, 'firstname' => 'Parent', 'lastname' => 'User', 'email' => 'parent@example.com', 'status' => 'Active', ]); $service = Mockery::mock(PaymentNotificationService::class); $service->shouldReceive('send')->once()->andReturn([ 'sent' => 1, 'skipped' => 0, 'failed' => 0, 'details' => [], ]); $this->app->instance(PaymentNotificationService::class, $service); $this->artisan('payments:monthly-reminder', ['--email' => 'parent@example.com'])->assertExitCode(0); } public function test_send_test_payment_notification_command_runs(): void { $service = Mockery::mock(PaymentTestNotificationService::class); $service->shouldReceive('send')->once()->andReturn(['ok' => true]); $this->app->instance(PaymentTestNotificationService::class, $service); $this->artisan('payments:send-test', ['--email' => 'parent@example.com'])->assertExitCode(0); } public function test_sync_paypal_payments_command_runs(): void { $service = Mockery::mock(PaypalPaymentSyncService::class); $service->shouldReceive('sync')->once()->andReturn([ 'mode' => 'DRY-RUN', 'processed' => 0, 'failed' => [], ]); $this->app->instance(PaypalPaymentSyncService::class, $service); $this->artisan('payments:sync-paypal', ['--dry-run' => true])->assertExitCode(0); } }