Files
alrahma_sunday_school_api/tests/Unit/Services/Refunds/RefundPayoutServiceTest.php
T
2026-06-09 01:25:14 -04:00

43 lines
1.1 KiB
PHP

<?php
namespace Tests\Unit\Services\Refunds;
use App\Services\Refunds\RefundPayoutService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class RefundPayoutServiceTest extends TestCase
{
use RefreshDatabase;
public function test_record_payment_marks_partial(): void
{
DB::table('refunds')->insert([
'id' => 1,
'parent_id' => 10,
'invoice_id' => 1,
'school_year' => '2025-2026',
'semester' => 'Fall',
'refund_amount' => 100,
'refund_paid_amount' => 0,
'status' => 'Approved',
'request' => 'overpayment',
'created_at' => now(),
'updated_at' => now(),
]);
$service = new RefundPayoutService;
$result = $service->recordPayment(1, [
'paid_amount' => 40,
'payment_method' => 'Cash',
], 2);
$this->assertTrue($result['ok']);
$this->assertDatabaseHas('refunds', [
'id' => 1,
'status' => 'Partial',
]);
}
}