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:
@@ -103,6 +103,52 @@ class ParentControllerTest extends TestCase
|
||||
$this->assertDatabaseHas('emergency_contacts', ['parent_id' => $parent->id, 'emergency_contact_name' => 'John Parent']);
|
||||
}
|
||||
|
||||
public function test_statement_returns_parent_account_and_invoice_lines(): void
|
||||
{
|
||||
$this->seedConfig();
|
||||
$parent = $this->seedParent();
|
||||
|
||||
DB::table('parent_accounts')->insert([
|
||||
'parent_id' => $parent->id,
|
||||
'school_year' => '2025-2026',
|
||||
'opening_balance' => 25,
|
||||
'current_balance' => 125,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
DB::table('invoices')->insert([
|
||||
'parent_id' => $parent->id,
|
||||
'invoice_number' => 'INV-2025-001',
|
||||
'total_amount' => 150,
|
||||
'paid_amount' => 50,
|
||||
'balance' => 100,
|
||||
'has_discount' => 0,
|
||||
'issue_date' => now(),
|
||||
'due_date' => now()->addWeek(),
|
||||
'status' => 'unpaid',
|
||||
'description' => 'Tuition invoice',
|
||||
'school_year' => '2025-2026',
|
||||
'semester' => 'Fall',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($parent);
|
||||
$response = $this->getJson('/api/v1/parents/statements?school_year=2025-2026');
|
||||
|
||||
$response->assertOk()
|
||||
->assertJsonPath('ok', true)
|
||||
->assertJsonPath('data.parent_id', $parent->id)
|
||||
->assertJsonPath('data.parent_name', 'Parent User')
|
||||
->assertJsonPath('data.school_year', '2025-2026')
|
||||
->assertJsonPath('data.opening_balance', 25)
|
||||
->assertJsonPath('data.current_balance', 125)
|
||||
->assertJsonPath('data.lines.0.label', 'Tuition invoice')
|
||||
->assertJsonPath('data.lines.0.amount', 100)
|
||||
->assertJsonPath('data.lines.0.source_school_year', '2025-2026');
|
||||
}
|
||||
|
||||
private function seedParent(): User
|
||||
{
|
||||
$roleId = DB::table('roles')->insertGetId([
|
||||
|
||||
Reference in New Issue
Block a user