<?php

use CodeIgniter\Test\CIUnitTestCase;

/**
 * @internal
 */
final class AttendanceServiceTest extends CIUnitTestCase
{
    public function testCalculateRateFromBreakdownCountsRecoveryAsAttendance(): void
    {
        $rate = service('attendance')->calculateRateFromBreakdown([
            'present' => 6,
            'recovery' => 1,
            'absent_excused' => 1,
            'absent_unexcused' => 2,
        ]);

        $this->assertSame(70.0, $rate);
    }

    public function testCalculateRateReturnsZeroForEmptyTotals(): void
    {
        $this->assertSame(0.0, service('attendance')->calculateRate(0, 0));
    }
}
