add controllers, servoices

This commit is contained in:
root
2026-03-09 02:52:13 -04:00
parent c8de5f7edc
commit d76c871cb7
501 changed files with 34439 additions and 21843 deletions
@@ -0,0 +1,61 @@
<?php
namespace Tests\Unit\Services\ExtraCharges;
use App\Services\ExtraCharges\ExtraChargesMetaService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class ExtraChargesMetaServiceTest extends TestCase
{
use RefreshDatabase;
public function test_get_school_years_uses_fallback(): void
{
$service = new ExtraChargesMetaService();
$years = $service->getSchoolYears('2025-2026');
$this->assertSame(['2025-2026', '2024-2025', '2023-2024', '2022-2023'], $years);
}
public function test_get_school_years_merges_sources(): void
{
DB::table('additional_charges')->insert([
[
'parent_id' => 1,
'school_year' => '2025-2026',
'semester' => 'Fall',
'charge_type' => 'add',
'title' => 'Test',
'amount' => 1,
],
[
'parent_id' => 1,
'school_year' => '2024-2025',
'semester' => 'Fall',
'charge_type' => 'add',
'title' => 'Test',
'amount' => 1,
],
]);
DB::table('invoices')->insert([
[
'parent_id' => 1,
'invoice_number' => 'INV-1',
'total_amount' => 10,
'balance' => 10,
'paid_amount' => 0,
'issue_date' => '2025-09-01',
'status' => 'Unpaid',
'school_year' => '2023-2024',
],
]);
$service = new ExtraChargesMetaService();
$years = $service->getSchoolYears();
$this->assertSame(['2025-2026', '2024-2025', '2023-2024'], $years);
}
}