30 lines
1.3 KiB
PHP
30 lines
1.3 KiB
PHP
<?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);
|
|
}
|
|
}
|