fix enrollment and registration email send
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 49s
Tests / PHPUnit (push) Failing after 1m20s

This commit is contained in:
root
2026-08-28 16:16:59 -04:00
parent 3133b3c584
commit d2cb159451
6 changed files with 118 additions and 73 deletions
@@ -334,6 +334,37 @@ final class EnrollmentRegistrationEmailServiceTest extends TestCase
$this->assertStringContainsString('not approved', implode(' ', $summary['messages']));
}
public function testFailedOnlyRetryUsesLatestFailedEmailRecordPerParent(): void
{
$query = new class {
public function getResultArray(): array
{
return [
['parent_user_id' => 10, 'delivery_status' => 'failed'],
['parent_user_id' => 10, 'delivery_status' => 'sent'],
['parent_user_id' => 20, 'delivery_status' => 'sent'],
['parent_user_id' => 20, 'delivery_status' => 'failed'],
['parent_user_id' => 30, 'delivery_status' => 'failed'],
['parent_user_id' => null, 'delivery_status' => 'failed'],
];
}
};
$builder = $this->createMock(BaseBuilder::class);
$builder->method('select')->willReturnSelf();
$builder->method('where')->with('school_year', '2026-2027')->willReturnSelf();
$builder->method('orderBy')->willReturnSelf();
$builder->method('get')->willReturn($query);
$db = $this->createMock(BaseConnection::class);
$db->method('tableExists')->with('enrollment_email_records')->willReturn(true);
$db->method('table')->with('enrollment_email_records')->willReturn($builder);
$service = $this->service($db);
$this->assertSame([10, 30], $this->invoke($service, 'failedParentIdsForSchoolYear', ['2026-2027']));
}
/**
* @param list<mixed> $args
*/