45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\AttendanceTracking;
|
|
|
|
use App\Models\AttendanceData;
|
|
use App\Models\AttendanceTracking;
|
|
use App\Models\Student;
|
|
use App\Services\AttendanceCaseQueryService;
|
|
use App\Services\AttendanceParentLookupService;
|
|
use App\Services\ViolationRuleEngineService;
|
|
use Mockery;
|
|
use Tests\TestCase;
|
|
|
|
class AttendanceCaseQueryServiceTest extends TestCase
|
|
{
|
|
protected function tearDown(): void
|
|
{
|
|
Mockery::close();
|
|
parent::tearDown();
|
|
}
|
|
|
|
public function test_get_student_case_returns_404_when_student_not_found(): void
|
|
{
|
|
$student = Mockery::mock(Student::class);
|
|
$student->shouldReceive('query->find')->with(99)->andReturn(null);
|
|
|
|
$attendanceData = Mockery::mock(AttendanceData::class);
|
|
$tracking = Mockery::mock(AttendanceTracking::class);
|
|
$rules = Mockery::mock(ViolationRuleEngineService::class);
|
|
$parents = Mockery::mock(AttendanceParentLookupService::class);
|
|
|
|
$service = new AttendanceCaseQueryService(
|
|
$student,
|
|
$attendanceData,
|
|
$tracking,
|
|
$rules,
|
|
$parents
|
|
);
|
|
|
|
$result = $service->getStudentCase(99);
|
|
|
|
$this->assertFalse($result['success']);
|
|
$this->assertSame(404, $result['status']);
|
|
}
|
|
} |