add refund and event logic
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Refunds;
|
||||
|
||||
use App\Services\Refunds\RefundQueryService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class RefundQueryServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_list_filters_by_status(): void
|
||||
{
|
||||
DB::table('refunds')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'parent_id' => 10,
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
'refund_amount' => 10,
|
||||
'refund_paid_amount' => 0,
|
||||
'status' => 'Pending',
|
||||
'request' => 'overpayment',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'parent_id' => 11,
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
'refund_amount' => 20,
|
||||
'refund_paid_amount' => 0,
|
||||
'status' => 'Approved',
|
||||
'request' => 'overpayment',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
]);
|
||||
|
||||
$service = new RefundQueryService();
|
||||
$result = $service->list(['status' => 'Approved', 'per_page' => 10, 'page' => 1]);
|
||||
|
||||
$this->assertSame(1, $result['pagination']['total']);
|
||||
$this->assertSame('Approved', $result['refunds']->items()[0]->status);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user