51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\AttendanceTracking;
|
|
|
|
use App\Models\AttendanceData;
|
|
use App\Models\Student;
|
|
use App\Models\StudentClass;
|
|
use App\Services\AttendanceTracking\AttendanceViolationStudentResolverService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Tests\TestCase;
|
|
|
|
class AttendanceViolationStudentResolverServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_resolve_for_school_year_returns_students(): void
|
|
{
|
|
DB::table('students')->insert([
|
|
'id' => 1,
|
|
'school_id' => 'S1',
|
|
'firstname' => 'Student',
|
|
'lastname' => 'One',
|
|
'age' => 8,
|
|
'gender' => 'Male',
|
|
'photo_consent' => 1,
|
|
'parent_id' => 1,
|
|
'year_of_registration' => '2025',
|
|
'school_year' => '2025-2026',
|
|
]);
|
|
|
|
DB::table('student_class')->insert([
|
|
'student_id' => 1,
|
|
'class_section_id' => 10,
|
|
'semester' => 'Fall',
|
|
'school_year' => '2025-2026',
|
|
]);
|
|
|
|
$service = new AttendanceViolationStudentResolverService(
|
|
new Student,
|
|
new StudentClass,
|
|
new AttendanceData
|
|
);
|
|
|
|
$result = $service->resolveForSchoolYear('2025-2026', 'Fall');
|
|
|
|
$this->assertContains(1, $result['student_ids']);
|
|
$this->assertNotEmpty($result['students']);
|
|
}
|
|
}
|