insert([ ['config_key' => 'school_year', 'config_value' => '2025-2026'], ['config_key' => 'semester', 'config_value' => 'Fall'], ]); DB::table('invoices')->insert([ 'id' => 1, 'parent_id' => 10, 'invoice_number' => 'INV-1', 'total_amount' => 100.00, 'balance' => 0.00, 'paid_amount' => 100.00, 'status' => 'Paid', 'school_year' => '2025-2026', 'semester' => 'Fall', 'issue_date' => '2025-01-05', ]); DB::table('payments')->insert([ 'id' => 1, 'parent_id' => 10, 'invoice_id' => 1, 'paid_amount' => 150.00, 'total_amount' => 150.00, 'balance' => 0.00, 'payment_date' => '2025-01-10', 'school_year' => '2025-2026', 'semester' => 'Fall', 'status' => 'Paid', ]); $service = new RefundOverpaymentService(new RefundNotificationService); $result = $service->recalculate(false, null, 1); $this->assertNotEmpty($result['created_ids']); $this->assertDatabaseHas('refunds', [ 'parent_id' => 10, 'request' => 'overpayment', ]); } }