fix logic and tests, update docker CI file

This commit is contained in:
root
2026-03-09 15:58:44 -04:00
parent 1cb3573d4b
commit 79e44fe037
188 changed files with 1776 additions and 524 deletions
@@ -20,14 +20,30 @@ class FeeCalculationControllerTest extends TestCase
$this->seedConfig();
$this->seedClassSection();
DB::table('invoices')->insert([
'id' => 1,
'parent_id' => 10,
'invoice_number' => 'INV-1',
'total_amount' => 200.00,
'balance' => 0.00,
'paid_amount' => 200.00,
'has_discount' => 0,
'issue_date' => '2025-01-05',
'status' => 'paid',
'school_year' => '2025-2026',
'semester' => 'Fall',
]);
DB::table('payments')->insert([
'id' => 1,
'parent_id' => 10,
'invoice_id' => 1,
'paid_amount' => 200.00,
'total_amount' => 200.00,
'balance' => 0.00,
'number_of_installments' => 1,
'payment_date' => '2025-01-10',
'payment_method' => 'manual',
'school_year' => '2025-2026',
'status' => 'Paid',
]);
@@ -33,7 +33,7 @@ class FinancialControllerTest extends TestCase
$user = $this->createUser();
Sanctum::actingAs($user);
$response = $this->getJson('/api/v1/finance/financial-summary?school_year=2025-2026');
$response = $this->getJson('/api/v1/finance/financial-summary?school_year=2025-2026&date_from=2025-01-01&date_to=2025-12-31');
$response->assertOk();
$response->assertJson(['ok' => true]);
@@ -56,6 +56,11 @@ class FinancialControllerTest extends TestCase
private function seedFinancialData(): void
{
DB::table('configuration')->insert([
'id' => 1,
'config_key' => 'school_year',
'config_value' => '2025-2026',
]);
DB::table('users')->insert([
[
'id' => 2,
@@ -62,6 +62,12 @@ class InvoiceControllerTest extends TestCase
private function seedBaseData(bool $withInvoice = true): void
{
DB::table('configuration')->insert([
'id' => 1,
'config_key' => 'school_year',
'config_value' => '2025-2026',
]);
DB::table('roles')->insert([
['id' => 1, 'name' => 'parent', 'slug' => 'parent', 'is_active' => 1],
]);
@@ -98,13 +104,20 @@ class InvoiceControllerTest extends TestCase
'firstname' => 'Kid',
'lastname' => 'User',
'school_id' => 1,
'age' => 10,
'gender' => 'Male',
'is_active' => 1,
'photo_consent' => 1,
'year_of_registration' => '2025',
'school_year' => '2025-2026',
]);
DB::table('classSection')->insert([
'class_section_id' => 1,
'class_section_name' => '1A',
'class_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
DB::table('student_class')->insert([
@@ -112,6 +125,7 @@ class InvoiceControllerTest extends TestCase
'class_section_id' => 1,
'school_year' => '2025-2026',
'is_event_only' => 0,
'semester' => 'Fall',
]);
DB::table('enrollments')->insert([
@@ -119,6 +133,7 @@ class InvoiceControllerTest extends TestCase
'parent_id' => 10,
'class_section_id' => 1,
'enrollment_status' => 'enrolled',
'enrollment_date' => '2025-01-10',
'school_year' => '2025-2026',
]);
@@ -17,8 +17,22 @@ class PaymentControllerTest extends TestCase
$this->seedUsers();
Sanctum::actingAs(User::query()->findOrFail(1));
DB::table('invoices')->insert([
'id' => 1,
'parent_id' => 10,
'invoice_number' => 'INV-001',
'total_amount' => 250,
'balance' => 250,
'paid_amount' => 0,
'has_discount' => 0,
'issue_date' => '2025-01-05',
'status' => 'unpaid',
'school_year' => '2025-2026',
]);
$response = $this->postJson('/api/v1/finance/payments', [
'parent_id' => 10,
'invoice_id' => 1,
'total_amount' => 250,
'number_of_installments' => 2,
'payment_date' => '2025-01-05',
@@ -102,7 +102,12 @@ class PaymentEventChargesControllerTest extends TestCase
'firstname' => 'Kid',
'lastname' => 'User',
'school_id' => 1,
'age' => 10,
'gender' => 'Male',
'is_active' => 1,
'photo_consent' => 1,
'year_of_registration' => '2025',
'school_year' => '2025-2026',
]);
}
}
@@ -111,7 +111,12 @@ class PaymentManualControllerTest extends TestCase
'firstname' => 'Kid',
'lastname' => 'User',
'school_id' => 1,
'age' => 10,
'gender' => 'Male',
'is_active' => 1,
'photo_consent' => 1,
'year_of_registration' => '2025',
'school_year' => '2025-2026',
]);
}
@@ -60,7 +60,7 @@ class PaypalTransactionsControllerTest extends TestCase
$response = $this->get('/api/v1/finance/paypal-transactions/csv');
$response->assertOk();
$response->assertHeader('Content-Type', 'text/csv');
$response->assertHeader('Content-Type', 'text/csv; charset=utf-8');
}
private function seedUsers(): void