fix family card issue
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 48s
Tests / PHPUnit (push) Failing after 1m27s

This commit is contained in:
root
2026-09-12 03:16:10 -04:00
parent ce504c933e
commit 1787144f27
11 changed files with 382 additions and 11 deletions
@@ -0,0 +1,29 @@
<?php
namespace Tests\App\Services;
use CodeIgniter\Test\CIUnitTestCase;
final class FamilyDataSyncWiringTest extends CIUnitTestCase
{
public function testStudentAddAndRemoveFlowsBothSynchronizeFamilyData(): void
{
$registration = file_get_contents(APPPATH . 'Services/Parents/ParentRegistrationService.php') ?: '';
$parentController = file_get_contents(APPPATH . 'Controllers/View/ParentController.php') ?: '';
$this->assertStringContainsString('FamilyDataSyncService($this->db))->syncForParent($parentId)', $registration);
$this->assertStringContainsString('FamilyDataSyncService($this->db))->syncForParent((int) $parentId)', $parentController);
}
public function testFamilySyncRefreshesContactDataAndAllCurrentStudents(): void
{
$source = file_get_contents(APPPATH . 'Services/FamilyDataSyncService.php') ?: '';
foreach (['household_name', 'address_line1', 'address_line2', 'city', 'state', 'postal_code', 'primary_phone'] as $field) {
$this->assertStringContainsString("'{$field}'", $source);
}
$this->assertStringContainsString("->where('parent_id', \$parentId)", $source);
$this->assertStringContainsString('INSERT IGNORE INTO family_students', $source);
$this->assertStringContainsString('INSERT IGNORE INTO family_guardians', $source);
}
}
@@ -0,0 +1,23 @@
<?php
namespace Tests\App\Views;
use CodeIgniter\Test\CIUnitTestCase;
final class FamilyCardLoaderLoopTest extends CIUnitTestCase
{
public function testFamilyLayoutsDoNotRedirectFamilyPageToItselfAfterCardFailure(): void
{
foreach (['management_layout.php', 'main_layout.php'] as $layout) {
$source = file_get_contents(APPPATH . 'Views/layout/' . $layout) ?: '';
$this->assertStringContainsString("const familyIndexPath = familyPath + '/index';", $source, $layout);
$this->assertStringContainsString(
'currentPath !== familyPath && currentPath !== familyIndexPath',
$source,
$layout
);
$this->assertStringContainsString('The family card could not be loaded.', $source, $layout);
}
}
}
+5 -2
View File
@@ -6,7 +6,7 @@ use CodeIgniter\Test\CIUnitTestCase;
final class FamilyCardViewTest extends CIUnitTestCase
{
public function testStudentNameExpandsCompleteStudentDetails(): void
public function testStudentNameKeepsCompleteStudentDetailsCollapsedInitially(): void
{
helper('time');
@@ -59,7 +59,10 @@ final class FamilyCardViewTest extends CIUnitTestCase
$this->assertStringContainsString('Test Student', $html);
$this->assertStringContainsString('data-bs-target="#fc-student-details-9-12"', $html);
$this->assertStringContainsString('accordion-collapse collapse show', $html);
$this->assertStringContainsString('class="accordion-button collapsed"', $html);
$this->assertStringContainsString('aria-expanded="false"', $html);
$this->assertStringContainsString('class="accordion-collapse collapse"', $html);
$this->assertStringNotContainsString('accordion-collapse collapse show', $html);
$this->assertStringContainsString('Student Details', $html);
$this->assertStringContainsString('STU-12', $html);
$this->assertStringContainsString('5 / 5-A', $html);