update project
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\SchoolCore\Attendance;
|
||||
|
||||
use App\Domain\SchoolCore\Attendance\DTO\AttendanceSessionView;
|
||||
use App\Domain\SchoolCore\Attendance\Policies\DefaultAttendanceStatusPolicy;
|
||||
use App\Domain\SchoolCore\Context\SchoolContext;
|
||||
use DateTimeImmutable;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class DefaultAttendanceStatusPolicyTest extends TestCase
|
||||
{
|
||||
public function test_status_becomes_late_after_default_threshold(): void
|
||||
{
|
||||
$context = new SchoolContext(1, 10, [], '2026', 'spring', 'UTC', 'en', 'USD', 'standard_school');
|
||||
$session = new AttendanceSessionView(1, 1, 'Morning', 'daily', new DateTimeImmutable('2026-05-29 09:00:00'), new DateTimeImmutable('2026-05-29 12:00:00'), 'UTC');
|
||||
$policy = new DefaultAttendanceStatusPolicy();
|
||||
|
||||
$this->assertSame('present', $policy->statusForScan($context, $session, new DateTimeImmutable('2026-05-29 09:05:00'))->status);
|
||||
$this->assertSame('late', $policy->statusForScan($context, $session, new DateTimeImmutable('2026-05-29 09:11:00'))->status);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Unit\SchoolCore\Attendance;
|
||||
|
||||
use App\Domain\SchoolCore\Attendance\DTO\ProcessScanData;
|
||||
use App\Domain\SchoolCore\Attendance\Support\ScanFingerprint;
|
||||
use App\Domain\SchoolCore\Context\SchoolContext;
|
||||
use DateTimeImmutable;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class ScanFingerprintTest extends TestCase
|
||||
{
|
||||
public function test_scan_fingerprint_is_school_scoped(): void
|
||||
{
|
||||
$scan = new ProcessScanData('ABC123', 'front', 'check_in', 'scanner', new DateTimeImmutable('2026-05-29 09:00:00'));
|
||||
$a = new SchoolContext(1, 10, [], '2026', 'spring', 'UTC', 'en', 'USD', 'standard_school');
|
||||
$b = new SchoolContext(2, 10, [], '2026', 'spring', 'UTC', 'en', 'USD', 'standard_school');
|
||||
|
||||
$this->assertNotSame(
|
||||
ScanFingerprint::fromScan($a, $scan, 90),
|
||||
ScanFingerprint::fromScan($b, $scan, 90)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user