add controllers, servoices
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Payments;
|
||||
|
||||
use App\Services\Payments\PaymentLookupService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PaymentLookupServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_get_by_parent_filters_school_year(): void
|
||||
{
|
||||
DB::table('payments')->insert([
|
||||
'id' => 1,
|
||||
'parent_id' => 10,
|
||||
'invoice_id' => 1,
|
||||
'total_amount' => 100,
|
||||
'paid_amount' => 20,
|
||||
'balance' => 80,
|
||||
'number_of_installments' => 1,
|
||||
'payment_method' => 'cash',
|
||||
'payment_date' => '2025-01-01',
|
||||
'school_year' => '2025-2026',
|
||||
'status' => 'Pending',
|
||||
]);
|
||||
|
||||
DB::table('payments')->insert([
|
||||
'id' => 2,
|
||||
'parent_id' => 10,
|
||||
'invoice_id' => 2,
|
||||
'total_amount' => 100,
|
||||
'paid_amount' => 20,
|
||||
'balance' => 80,
|
||||
'number_of_installments' => 1,
|
||||
'payment_method' => 'cash',
|
||||
'payment_date' => '2024-01-01',
|
||||
'school_year' => '2024-2025',
|
||||
'status' => 'Pending',
|
||||
]);
|
||||
|
||||
$service = new PaymentLookupService();
|
||||
$results = $service->getByParent(10, '2025-2026');
|
||||
|
||||
$this->assertCount(1, $results);
|
||||
$this->assertSame(1, $results[0]['id']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user