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
@@ -22,9 +22,9 @@ class AssignmentMetaServiceTest extends TestCase
public function test_get_school_years_returns_distinct_sorted(): void
{
DB::table('teacher_class')->insert([
['class_section_id' => 101, 'teacher_id' => 1, 'position' => 'main', 'school_year' => '2024-2025'],
['class_section_id' => 102, 'teacher_id' => 2, 'position' => 'main', 'school_year' => '2025-2026'],
['class_section_id' => 103, 'teacher_id' => 3, 'position' => 'main', 'school_year' => '2025-2026'],
['class_section_id' => 101, 'teacher_id' => 1, 'position' => 'main', 'school_year' => '2024-2025', 'semester' => 'Fall'],
['class_section_id' => 102, 'teacher_id' => 2, 'position' => 'main', 'school_year' => '2025-2026', 'semester' => 'Fall'],
['class_section_id' => 103, 'teacher_id' => 3, 'position' => 'main', 'school_year' => '2025-2026', 'semester' => 'Fall'],
]);
$service = new AssignmentMetaService();
@@ -153,7 +153,7 @@ class AssignmentServiceTest extends TestCase
'teacher_id' => $this->teacherMain->id,
'class_section_id' => $this->sectionA->id,
'position' => 'main',
'semester' => null,
'semester' => '',
'school_year' => null,
'description' => null,
]);
@@ -387,4 +387,4 @@ class AssignmentServiceTest extends TestCase
$result['classSections'][0]['main_teachers']
);
}
}
}
@@ -16,8 +16,8 @@ class AdminAttendanceApiControllerTest extends TestCase
$user = User::factory()->create();
Sanctum::actingAs($user);
$response = $this->getJson('/api/attendance/admin/daily');
$response = $this->getJson('/api/v1/attendance/admin/daily');
$response->assertStatus(200);
}
}
}
@@ -94,7 +94,7 @@ class AttendanceServiceTest extends TestCase
$this->assertTrue($result['ok']);
$this->assertDatabaseHas('attendance_day', [
'class_section_id' => 1,
'date' => '2025-01-01',
'date' => '2025-01-01 00:00:00',
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
@@ -16,7 +16,7 @@ class StaffAttendanceApiControllerTest extends TestCase
$user = User::factory()->create();
Sanctum::actingAs($user);
$response = $this->getJson('/api/attendance/staff/month');
$response = $this->getJson('/api/v1/attendance/staff/month');
$response->assertStatus(200);
}
@@ -26,8 +26,8 @@ class StaffAttendanceApiControllerTest extends TestCase
$user = User::factory()->create();
Sanctum::actingAs($user);
$response = $this->getJson('/api/attendance/staff/admins');
$response = $this->getJson('/api/v1/attendance/staff/admins');
$response->assertStatus(200);
}
}
}
@@ -68,7 +68,7 @@ class StaffAttendanceServiceTest extends TestCase
DB::table('calendar_events')->insert([
'title' => 'No School',
'date' => '2025-09-14',
'date' => '2025-09-21',
'no_school' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
@@ -85,6 +85,6 @@ class StaffAttendanceServiceTest extends TestCase
$payload = $service->monthData('Fall', '2025-2026');
$this->assertNotEmpty($payload['sections']);
$this->assertContains('2025-09-14', $payload['noSchoolDays']);
$this->assertContains('2025-09-21', $payload['noSchoolDays']);
}
}
@@ -16,7 +16,7 @@ class TeacherAttendanceApiControllerTest extends TestCase
$user = User::factory()->create();
Sanctum::actingAs($user);
$response = $this->getJson('/api/attendance/teacher/grid');
$response = $this->getJson('/api/v1/attendance/teacher/grid');
$response->assertStatus(200);
}
@@ -26,8 +26,8 @@ class TeacherAttendanceApiControllerTest extends TestCase
$user = User::factory()->create();
Sanctum::actingAs($user);
$response = $this->getJson('/api/attendance/teacher/form');
$response = $this->getJson('/api/v1/attendance/teacher/form');
$this->assertContains($response->status(), [200, 422]);
}
}
}
@@ -42,7 +42,7 @@ class AttendanceCommunicationSupportServiceTest extends TestCase
]);
$service = $this->makeService();
$dates = $service->getViolationDatesForStudent(1, 'ABS_1');
$dates = $service->getViolationDatesForStudent(1, 'ABS_1', '2025-01-01');
$this->assertSame(['2025-01-01'], $dates);
}
@@ -19,7 +19,7 @@ class AttendanceNotificationLogServiceTest extends TestCase
$this->assertDatabaseHas('parent_notifications', [
'student_id' => 1,
'code' => 'ABS_1',
'incident_date' => '2025-01-01',
'incident_date' => '2025-01-01 00:00:00',
'channel' => 'email',
'to_address' => 'parent@example.com',
'status' => 'sent',
@@ -27,6 +27,9 @@ class AttendanceNotificationWorkflowServiceTest extends TestCase
'school_year' => '2025-2026',
]);
$parentLookup = Mockery::mock(\App\Services\AttendanceTracking\AttendanceParentLookupService::class);
$parentLookup->shouldReceive('getPrimaryParentForStudent')->once()->andReturn([]);
$service = new AttendanceNotificationWorkflowService(
new \App\Models\Student(),
new \App\Models\StudentClass(),
@@ -35,7 +38,7 @@ class AttendanceNotificationWorkflowServiceTest extends TestCase
new \App\Models\Configuration(),
Mockery::mock(\App\Services\AttendanceTracking\AttendanceMailerService::class),
Mockery::mock(\App\Services\AttendanceTracking\ViolationRuleEngineService::class),
Mockery::mock(\App\Services\AttendanceTracking\AttendanceParentLookupService::class),
$parentLookup,
Mockery::mock(\App\Services\AttendanceTracking\AttendanceEmailComposerService::class),
Mockery::mock(\App\Services\AttendanceTracking\AttendanceNotificationLogService::class)
);
@@ -110,7 +110,7 @@ class BadgePdfServiceTest extends TestCase
'school_year' => '2025-2026',
];
$lookup->shouldReceive('getUserInfoById')->twice()->andReturn($userInfo);
$lookup->shouldReceive('getUserInfoById')->once()->andReturn($userInfo);
$printLog->shouldReceive('logSafely')
->once()
@@ -129,4 +129,4 @@ class BadgePdfServiceTest extends TestCase
$this->assertSame(200, $response->getStatusCode());
$this->assertSame('application/pdf', $response->headers->get('Content-Type'));
}
}
}
@@ -45,6 +45,7 @@ class ClassPreparationCalculatorServiceTest extends TestCase
'class_section_id' => 101,
'teacher_id' => 1,
'position' => 'main',
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
@@ -15,7 +15,7 @@ class ClassPreparationServiceTest extends TestCase
{
$this->seedPrepData();
$service = new ClassPreparationService();
$service = app(ClassPreparationService::class);
$payload = $service->listPrep('2025-2026', 'Fall');
$this->assertSame('2025-2026', $payload['schoolYear']);
@@ -28,7 +28,7 @@ class ClassPreparationServiceTest extends TestCase
{
$this->seedPrepData();
$service = new ClassPreparationService();
$service = app(ClassPreparationService::class);
$count = $service->markPrinted('2025-2026', 'Fall', [101]);
$this->assertSame(1, $count);
@@ -35,9 +35,22 @@ class FeeRefundCalculatorServiceTest extends TestCase
'school_year' => '2025-2026',
]);
DB::table('invoices')->insert([
'id' => 1,
'parent_id' => 99,
'invoice_number' => 'INV-1',
'total_amount' => 100.00,
'balance' => 0.00,
'paid_amount' => 100.00,
'issue_date' => '2025-01-01',
'school_year' => '2025-2026',
'semester' => 'Fall',
]);
DB::table('payments')->insert([
'id' => 1,
'parent_id' => 99,
'invoice_id' => 1,
'paid_amount' => 100.00,
'total_amount' => 100.00,
'balance' => 0.00,
@@ -72,6 +72,7 @@ class FinancialReportServiceTest extends TestCase
'refund_amount' => 5,
'status' => 'Paid',
'refund_paid_amount' => 5,
'refunded_at' => '2025-01-03 10:00:00',
]);
DB::table('discount_usages')->insert([
@@ -81,6 +82,8 @@ class FinancialReportServiceTest extends TestCase
'parent_id' => 10,
'discount_amount' => 10,
'school_year' => '2025-2026',
'used_at' => '2025-01-04 10:00:00',
'created_at' => '2025-01-04 10:00:00',
]);
DB::table('expenses')->insert([
@@ -93,6 +96,7 @@ class FinancialReportServiceTest extends TestCase
'school_year' => '2025-2026',
'semester' => 'Fall',
'status' => 'approved',
'created_at' => '2025-01-05 12:00:00',
]);
DB::table('reimbursements')->insert([
@@ -104,6 +108,7 @@ class FinancialReportServiceTest extends TestCase
'status' => 'Paid',
'school_year' => '2025-2026',
'semester' => 'Fall',
'created_at' => '2025-01-06 12:00:00',
]);
$service = new FinancialReportService(
@@ -70,6 +70,8 @@ class FinancialSummaryServiceTest extends TestCase
'parent_id' => 2,
'discount_amount' => 10,
'school_year' => '2025-2026',
'used_at' => '2025-01-11 10:00:00',
'created_at' => '2025-01-11 10:00:00',
]);
DB::table('refunds')->insert([
@@ -80,13 +82,19 @@ class FinancialSummaryServiceTest extends TestCase
'refund_amount' => 5,
'status' => 'Paid',
'refund_paid_amount' => 5,
'refunded_at' => '2025-01-12 10:00:00',
'created_at' => '2025-01-12 10:00:00',
]);
DB::table('additional_charges')->insert([
[
'id' => 1,
'parent_id' => 2,
'invoice_id' => null,
'semester' => 'Fall',
'title' => 'Extra Charge',
'amount' => 20,
'due_date' => '2025-01-12',
'school_year' => '2025-2026',
'status' => 'pending',
],
@@ -95,6 +103,9 @@ class FinancialSummaryServiceTest extends TestCase
'parent_id' => 2,
'amount' => 30,
'invoice_id' => 1,
'semester' => 'Fall',
'title' => 'Applied Charge',
'due_date' => '2025-01-12',
'school_year' => '2025-2026',
'status' => 'applied',
],
@@ -111,6 +122,7 @@ class FinancialSummaryServiceTest extends TestCase
'school_year' => '2025-2026',
'semester' => 'Fall',
'status' => 'approved',
'created_at' => '2025-01-05 12:00:00',
],
[
'id' => 2,
@@ -122,6 +134,7 @@ class FinancialSummaryServiceTest extends TestCase
'school_year' => '2025-2026',
'semester' => 'Fall',
'status' => 'approved',
'created_at' => '2025-01-06 12:00:00',
],
]);
@@ -135,6 +148,7 @@ class FinancialSummaryServiceTest extends TestCase
'status' => 'Paid',
'school_year' => '2025-2026',
'semester' => 'Fall',
'created_at' => '2025-01-07 12:00:00',
],
[
'id' => 2,
@@ -145,6 +159,7 @@ class FinancialSummaryServiceTest extends TestCase
'status' => 'Paid',
'school_year' => '2025-2026',
'semester' => 'Fall',
'created_at' => '2025-01-08 12:00:00',
],
]);
@@ -91,6 +91,9 @@ class FinancialUnpaidParentsServiceTest extends TestCase
DB::table('additional_charges')->insert([
'id' => 1,
'parent_id' => 2,
'invoice_id' => null,
'semester' => 'Fall',
'title' => 'Extra Charge',
'amount' => 20,
'school_year' => '2025-2026',
'status' => 'pending',
@@ -42,7 +42,12 @@ class InvoiceGenerationServiceTest extends TestCase
'parent_id' => 10,
'firstname' => 'Kid',
'lastname' => 'User',
'school_id' => 1,
'school_id' => 'S1',
'age' => 8,
'gender' => 'Male',
'photo_consent' => 1,
'year_of_registration' => '2025',
'school_year' => '2025-2026',
'is_active' => 1,
]);
@@ -50,11 +55,14 @@ class InvoiceGenerationServiceTest extends TestCase
'class_section_id' => 1,
'class_section_name' => '1A',
'class_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
DB::table('student_class')->insert([
'student_id' => 100,
'class_section_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
'is_event_only' => 0,
]);
@@ -63,7 +71,9 @@ class InvoiceGenerationServiceTest extends TestCase
'student_id' => 100,
'parent_id' => 10,
'class_section_id' => 1,
'enrollment_date' => '2025-01-01',
'enrollment_status' => 'enrolled',
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
@@ -49,7 +49,12 @@ class InvoiceManagementServiceTest extends TestCase
'parent_id' => 10,
'firstname' => 'Kid',
'lastname' => 'User',
'school_id' => 1,
'school_id' => 'S1',
'age' => 8,
'gender' => 'Male',
'photo_consent' => 1,
'year_of_registration' => '2025',
'school_year' => '2025-2026',
'is_active' => 1,
]);
@@ -57,11 +62,14 @@ class InvoiceManagementServiceTest extends TestCase
'class_section_id' => 1,
'class_section_name' => '1A',
'class_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
DB::table('student_class')->insert([
'student_id' => 100,
'class_section_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
'is_event_only' => 0,
]);
@@ -70,7 +78,9 @@ class InvoiceManagementServiceTest extends TestCase
'student_id' => 100,
'parent_id' => 10,
'class_section_id' => 1,
'enrollment_date' => '2025-01-01',
'enrollment_status' => 'enrolled',
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
@@ -41,7 +41,12 @@ class InvoicePdfServiceTest extends TestCase
'parent_id' => 10,
'firstname' => 'Kid',
'lastname' => 'User',
'school_id' => 1,
'school_id' => 'S1',
'age' => 8,
'gender' => 'Male',
'photo_consent' => 1,
'year_of_registration' => '2025',
'school_year' => '2025-2026',
'is_active' => 1,
]);
@@ -49,11 +54,14 @@ class InvoicePdfServiceTest extends TestCase
'class_section_id' => 1,
'class_section_name' => '1A',
'class_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
DB::table('student_class')->insert([
'student_id' => 100,
'class_section_id' => 1,
'semester' => 'Fall',
'school_year' => '2025-2026',
'is_event_only' => 0,
]);
@@ -62,7 +70,9 @@ class InvoicePdfServiceTest extends TestCase
'student_id' => 100,
'parent_id' => 10,
'class_section_id' => 1,
'enrollment_date' => '2025-01-01',
'enrollment_status' => 'enrolled',
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
@@ -15,9 +15,9 @@ class InvoiceTuitionServiceTest extends TestCase
public function test_calculate_tuition_fee_counts_regular_and_youth(): void
{
DB::table('classSection')->insert([
['class_section_id' => 1, 'class_section_name' => '1', 'class_id' => 1],
['class_section_id' => 2, 'class_section_name' => '2', 'class_id' => 2],
['class_section_id' => 3, 'class_section_name' => '10', 'class_id' => 10],
['class_section_id' => 1, 'class_section_name' => '1', 'class_id' => 1, 'semester' => 'Fall', 'school_year' => '2025-2026'],
['class_section_id' => 2, 'class_section_name' => '2', 'class_id' => 2, 'semester' => 'Fall', 'school_year' => '2025-2026'],
['class_section_id' => 3, 'class_section_name' => '10', 'class_id' => 10, 'semester' => 'Fall', 'school_year' => '2025-2026'],
]);
$grades = new InvoiceGradeService(9);
@@ -37,8 +37,8 @@ class InvoiceTuitionServiceTest extends TestCase
public function test_refund_deadline_includes_withdrawn_when_passed(): void
{
DB::table('classSection')->insert([
['class_section_id' => 1, 'class_section_name' => '1', 'class_id' => 1],
['class_section_id' => 2, 'class_section_name' => '2', 'class_id' => 2],
['class_section_id' => 1, 'class_section_name' => '1', 'class_id' => 1, 'semester' => 'Fall', 'school_year' => '2025-2026'],
['class_section_id' => 2, 'class_section_name' => '2', 'class_id' => 2, 'semester' => 'Fall', 'school_year' => '2025-2026'],
]);
$grades = new InvoiceGradeService(9);