fix logo circle, start email body
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Services\EmailService;
|
||||
use App\Services\EnrollmentRegistrationEmailService;
|
||||
use App\Services\EnrollmentTransitionService;
|
||||
use App\Support\Enrollment\DeliberationDecision;
|
||||
use App\Models\ConfigurationModel;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Database\BaseConnection;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -55,18 +56,75 @@ final class EnrollmentRegistrationEmailServiceTest extends TestCase
|
||||
$this->assertSame('', $html);
|
||||
}
|
||||
|
||||
public function testMakeupExamDecisionMessageUsesConfiguredDate(): void
|
||||
{
|
||||
$configModel = $this->createMock(ConfigurationModel::class);
|
||||
$configModel->expects($this->once())
|
||||
->method('getConfig')
|
||||
->with('make-up-exam')
|
||||
->willReturn('2026-09-13');
|
||||
|
||||
$service = $this->service(configModel: $configModel);
|
||||
|
||||
$message = $this->invoke($service, 'decisionMessage', ['Student Name', [
|
||||
'deliberation_decision' => DeliberationDecision::MAKE_UP_EXAM,
|
||||
'blockers' => [],
|
||||
], 'August 1, 2026', 'August 31, 2026']);
|
||||
|
||||
$this->assertStringContainsString('The final academic decision for Student Name is currently pending the result of a make-up exam.', $message);
|
||||
$this->assertStringContainsString('This exam is scheduled for 09-13-2026 from 9:30 AM to 11:00 AM at ISGL.', $message);
|
||||
$this->assertStringContainsString("\n" . 'The exam result will determine whether the student advances to the next grade or repeats the current class. Failure to attend the make-up exam will automatically result in the student repeating the class, as no further retake opportunities will be available.', $message);
|
||||
$this->assertStringContainsString("\n" . 'You must re-enroll Student Name before the make-up exam can be taken.', $message);
|
||||
$this->assertStringNotContainsString('on date at ISGL', $message);
|
||||
|
||||
$action = $this->invoke($service, 'requiredAction', [[
|
||||
'deliberation_decision' => DeliberationDecision::MAKE_UP_EXAM,
|
||||
'blockers' => [],
|
||||
], 'August 31, 2026', 'Student Name']);
|
||||
|
||||
$this->assertSame('', $action);
|
||||
}
|
||||
|
||||
public function testMakeupExamStudentRowRendersMessageLineBreaks(): void
|
||||
{
|
||||
$configModel = $this->createMock(ConfigurationModel::class);
|
||||
$configModel->method('getConfig')
|
||||
->with('make-up-exam')
|
||||
->willReturn('2026-09-13');
|
||||
|
||||
$service = $this->service(configModel: $configModel);
|
||||
|
||||
$html = $this->invoke($service, 'studentRow', [[
|
||||
'firstname' => 'Student',
|
||||
'lastname' => 'Name',
|
||||
], [
|
||||
'deliberation_decision' => DeliberationDecision::MAKE_UP_EXAM,
|
||||
'placement_status' => 'temporary_same_grade',
|
||||
'blockers' => [],
|
||||
], 'August 1, 2026', 'August 31, 2026']);
|
||||
|
||||
$this->assertStringContainsString('from 9:30 AM to 11:00 AM at ISGL.<br>', $html);
|
||||
$this->assertStringContainsString('available.<br>', $html);
|
||||
$this->assertStringContainsString('<strong>You must re-enroll Student Name before the make-up exam can be taken.</strong>', $html);
|
||||
$this->assertStringNotContainsString('before they are permitted', $html);
|
||||
}
|
||||
|
||||
public function testFinancialSectionShowsWhenAnyAmountIsDue(): void
|
||||
{
|
||||
$service = $this->service();
|
||||
|
||||
$html = $this->invoke($service, 'financialSection', [10, [
|
||||
'registration_fee' => 25,
|
||||
'tuition_due_at_registration' => 0,
|
||||
'mandatory_fees' => 0,
|
||||
'tuition_due_at_registration' => 10,
|
||||
'mandatory_fees' => 5,
|
||||
], null]);
|
||||
|
||||
$this->assertStringContainsString('Family Account Information', $html);
|
||||
$this->assertStringContainsString('Total currently due:</strong> $25.00', $html);
|
||||
$this->assertStringContainsString('Carry-over balance:</strong> $0.00', $html);
|
||||
$this->assertStringContainsString('Total currently due:</strong> $40.00', $html);
|
||||
$this->assertStringNotContainsString('Registration fee:', $html);
|
||||
$this->assertStringNotContainsString('New-year tuition due now:', $html);
|
||||
$this->assertStringNotContainsString('Mandatory fees:', $html);
|
||||
}
|
||||
|
||||
public function testAutomaticDistributionPlacementShowsOnlyGrade(): void
|
||||
@@ -81,6 +139,75 @@ final class EnrollmentRegistrationEmailServiceTest extends TestCase
|
||||
$this->assertSame('Grade 9', $placement);
|
||||
}
|
||||
|
||||
public function testStudentSummaryUsesStackedEmailRows(): void
|
||||
{
|
||||
$service = $this->service();
|
||||
|
||||
$html = $this->invoke($service, 'studentRow', [[
|
||||
'firstname' => 'Test',
|
||||
'lastname' => 'Student',
|
||||
], [
|
||||
'deliberation_decision' => DeliberationDecision::PASSED,
|
||||
'placement_status' => 'automatic_distribution_pending',
|
||||
'source_grade_name' => '4',
|
||||
'assigned_grade_name' => '5',
|
||||
'blockers' => [],
|
||||
], 'August 1, 2026', 'August 31, 2026']);
|
||||
|
||||
$this->assertStringContainsString('role="presentation"', $html);
|
||||
$this->assertStringContainsString('Decision', $html);
|
||||
$this->assertStringContainsString('Registration Status', $html);
|
||||
$this->assertStringContainsString('Next Step', $html);
|
||||
$this->assertStringContainsString('word-break:break-word', $html);
|
||||
$this->assertStringNotContainsString('</td><td', $html);
|
||||
}
|
||||
|
||||
public function testStudentsTableWrapsStackedStudentBlocks(): void
|
||||
{
|
||||
$service = $this->service();
|
||||
|
||||
$html = $this->invoke($service, 'studentsTable', [['<table role="presentation"></table>']]);
|
||||
|
||||
$this->assertStringStartsWith('<div style="margin:12px 0 18px;">', $html);
|
||||
$this->assertStringContainsString('<table role="presentation"></table>', $html);
|
||||
$this->assertStringEndsWith('</div>', $html);
|
||||
}
|
||||
|
||||
public function testRegistrationStepsSectionIsHiddenWhenNoStudentCanReEnroll(): void
|
||||
{
|
||||
$service = $this->service();
|
||||
|
||||
$html = $this->invoke($service, 'registrationStepsSection', ['August 1, 2026', 'August 31, 2026', false]);
|
||||
|
||||
$this->assertSame('', $html);
|
||||
}
|
||||
|
||||
public function testRegistrationStepsSectionShowsWhenAnyStudentCanReEnroll(): void
|
||||
{
|
||||
$service = $this->service();
|
||||
|
||||
$html = $this->invoke($service, 'registrationStepsSection', ['August 1, 2026', 'August 31, 2026', true]);
|
||||
|
||||
$this->assertStringContainsString('Re-enrollment Steps', $html);
|
||||
$this->assertStringContainsString('Sign in to the parent portal.', $html);
|
||||
$this->assertStringContainsString('parent/enroll_classes', $html);
|
||||
}
|
||||
|
||||
public function testParentReEnrollmentEligibilityUsesTransitionAllowedFlag(): void
|
||||
{
|
||||
$service = $this->service();
|
||||
|
||||
$this->assertTrue($this->invoke($service, 'canCompleteParentReEnrollment', [[
|
||||
'parent_enrollment_allowed' => true,
|
||||
'blockers' => [],
|
||||
]]));
|
||||
|
||||
$this->assertFalse($this->invoke($service, 'canCompleteParentReEnrollment', [[
|
||||
'parent_enrollment_allowed' => false,
|
||||
'blockers' => ['Contact administration.'],
|
||||
]]));
|
||||
}
|
||||
|
||||
public function testForceCannotSendWithoutAdminLaunchApproval(): void
|
||||
{
|
||||
$emailService = $this->createMock(EmailService::class);
|
||||
@@ -108,7 +235,7 @@ final class EnrollmentRegistrationEmailServiceTest extends TestCase
|
||||
return $reflection->invokeArgs($service, $args);
|
||||
}
|
||||
|
||||
private function service(?BaseConnection $db = null, ?EmailService $emailService = null): EnrollmentRegistrationEmailService
|
||||
private function service(?BaseConnection $db = null, ?EmailService $emailService = null, ?ConfigurationModel $configModel = null): EnrollmentRegistrationEmailService
|
||||
{
|
||||
$db ??= $this->createMock(BaseConnection::class);
|
||||
|
||||
@@ -116,6 +243,7 @@ final class EnrollmentRegistrationEmailServiceTest extends TestCase
|
||||
$db,
|
||||
new EnrollmentTransitionService($db),
|
||||
$emailService ?? $this->createMock(EmailService::class),
|
||||
$configModel,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user