fix parent pages and teachers and admin
API CI/CD / Validate (composer + pint) (push) Successful in 3m8s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Test (PHPUnit) (push) Failing after 6m5s
API CI/CD / Security audit (push) Failing after 52s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m8s
API CI/CD / Build frontend assets (push) Successful in 1m2s
API CI/CD / Test (PHPUnit) (push) Failing after 6m5s
API CI/CD / Security audit (push) Failing after 52s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -50,6 +50,67 @@ class ParentEnrollmentServiceTest extends TestCase
|
||||
$this->assertSame('enrolled', $result['students'][0]['enrollment_status']);
|
||||
}
|
||||
|
||||
public function test_withdrawal_request_creates_pending_zero_amount_refund(): void
|
||||
{
|
||||
$this->seedConfig();
|
||||
$parentId = $this->seedParent();
|
||||
|
||||
$studentId = DB::table('students')->insertGetId([
|
||||
'school_id' => 'S-201',
|
||||
'firstname' => 'Omar',
|
||||
'lastname' => 'Parent',
|
||||
'dob' => '2014-09-01',
|
||||
'age' => 11,
|
||||
'gender' => 'Male',
|
||||
'photo_consent' => 1,
|
||||
'parent_id' => $parentId,
|
||||
'year_of_registration' => '2025',
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
]);
|
||||
|
||||
DB::table('enrollments')->insert([
|
||||
'student_id' => $studentId,
|
||||
'parent_id' => $parentId,
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
'enrollment_date' => '2025-09-01',
|
||||
'enrollment_status' => 'enrolled',
|
||||
'admission_status' => 'accepted',
|
||||
'is_withdrawn' => 0,
|
||||
]);
|
||||
|
||||
$invoiceId = DB::table('invoices')->insertGetId([
|
||||
'parent_id' => $parentId,
|
||||
'invoice_number' => 'INV-201',
|
||||
'total_amount' => 100,
|
||||
'paid_amount' => 100,
|
||||
'balance' => 0,
|
||||
'issue_date' => now(),
|
||||
'due_date' => now()->addWeek(),
|
||||
'status' => 'paid',
|
||||
'description' => 'Tuition',
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$service = new ParentEnrollmentService(new ParentConfigService);
|
||||
$result = $service->updateEnrollment($parentId, [], [$studentId]);
|
||||
|
||||
$this->assertSame([$studentId], $result['withdrawn']);
|
||||
$this->assertDatabaseHas('refunds', [
|
||||
'parent_id' => $parentId,
|
||||
'invoice_id' => $invoiceId,
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
'status' => 'Pending',
|
||||
'refund_amount' => 0,
|
||||
'refund_paid_amount' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
private function seedParent(): int
|
||||
{
|
||||
return DB::table('users')->insertGetId([
|
||||
|
||||
Reference in New Issue
Block a user