fix financial issues

This commit is contained in:
root
2026-06-01 02:08:27 -04:00
parent 090cb88573
commit 6444b61416
56 changed files with 4196 additions and 1824 deletions
@@ -0,0 +1,53 @@
<?php
namespace Tests\App\Helpers;
use CodeIgniter\Test\CIUnitTestCase;
class AttendanceCommentHelperTest extends CIUnitTestCase
{
protected function setUp(): void
{
parent::setUp();
helper('attendance_comment');
}
public function testTemplateMatchReturnsDirectRangeHit(): void
{
$templates = [
['min_score' => 60, 'max_score' => 69, 'template_text' => 'below average'],
['min_score' => 70, 'max_score' => 79, 'template_text' => 'fair'],
];
$match = attendance_comment_template_match($templates, 70.0);
$this->assertNotNull($match);
$this->assertSame('fair', $match['template_text']);
}
public function testTemplateMatchFallsBackToNearestLowerBandForDecimalGap(): void
{
$templates = [
['min_score' => 60, 'max_score' => 69, 'template_text' => 'below average'],
['min_score' => 70, 'max_score' => 79, 'template_text' => 'fair'],
];
$match = attendance_comment_template_match($templates, 69.23);
$this->assertNotNull($match);
$this->assertSame('below average', $match['template_text']);
}
public function testCommentUsesResolvedTemplateForDecimalGap(): void
{
$templates = [
['min_score' => 60, 'max_score' => 69, 'template_text' => 'attendance has been below average.'],
['min_score' => 70, 'max_score' => 79, 'template_text' => 'attendance has been fair.'],
];
$match = attendance_comment_template_match($templates, 69.23);
$this->assertNotNull($match);
$this->assertSame('attendance has been below average.', $match['template_text']);
}
}