fix registration issue and split parent controller into services
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 49s
Tests / PHPUnit (push) Successful in 1m32s

This commit is contained in:
root
2026-08-30 20:40:35 -04:00
parent 361d0c0d3a
commit 140be9922d
9 changed files with 2458 additions and 1306 deletions
+44
View File
@@ -54,6 +54,50 @@ class StudentModelTest extends ModelCrudTestCase
$this->assertNotContains($returningStudentId, $ids);
}
public function testEnrollmentWithdrawalRosterExcludesRegisteredOnlyStudents(): void
{
$db = Database::connect('tests');
$schoolYear = $this->validSchoolYear();
$parentId = $this->insertParent($db, 'parent-roster-filter@example.test');
$registeredOnlyId = $this->insertStudent($db, $parentId, 'Registered', 'Only');
$enrolledId = $this->insertStudent($db, $parentId, 'Roster', 'Student');
$db->table('student_year_status')->insert([
'student_id' => $registeredOnlyId,
'school_year' => $schoolYear,
'is_new' => 1,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
$db->table('student_year_status')->insert([
'student_id' => $enrolledId,
'school_year' => $schoolYear,
'is_new' => 1,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
$db->table('enrollments')->insert([
'student_id' => $enrolledId,
'class_section_id' => null,
'parent_id' => $parentId,
'enrollment_date' => date('Y-m-d'),
'enrollment_status' => 'admission under review',
'withdrawal_date' => null,
'is_withdrawn' => 0,
'admission_status' => 'pending',
'semester' => 'Fall',
'school_year' => $schoolYear,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
$rows = (new StudentModel())->getStudentsWithClassAndEnrollment($schoolYear);
$ids = array_map(static fn (array $row): int => (int) $row['id'], $rows);
$this->assertNotContains($registeredOnlyId, $ids);
$this->assertContains($enrolledId, $ids);
}
private function insertParent($db, string $email): int
{
$db->table('users')->insert([