<?php

namespace Tests\Unit\Services\Administrator;

use App\Services\Administrator\AdministratorEnrollmentRefundService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Mockery;
use Tests\TestCase;

class AdministratorEnrollmentRefundServiceTest extends TestCase
{
    use RefreshDatabase;

    public function test_process_refunds_reports_missing_invoice(): void
    {
        DB::table('enrollments')->insert([
            'id' => 1,
            'student_id' => 1,
            'parent_id' => 10,
            'enrollment_date' => '2025-01-01',
            'enrollment_status' => 'withdrawn',
            'is_withdrawn' => 1,
            'school_year' => '2025-2026',
        ]);

        $feeCalc = Mockery::mock(\App\Services\FeeCalculationService::class);
        $service = new AdministratorEnrollmentRefundService($feeCalc);

        $result = $service->processRefunds([10], '2025-2026', 1);

        $this->assertNotEmpty($result['errors']);
    }
}
