sendFollowUp([ 'parent' => ['user_id' => 5], ]); $this->assertFalse($result['ok']); } public function test_send_follow_up_marks_tracking_and_notifies(): void { \Illuminate\Support\Facades\DB::table('students')->insert([ 'id' => 1, 'school_id' => 1, 'parent_id' => 1, 'firstname' => 'Student', 'lastname' => 'One', 'dob' => '2015-01-01', 'age' => 10, 'gender' => 'Male', 'is_active' => 1, 'photo_consent' => 1, 'year_of_registration' => '2025', 'school_year' => '2025-2026', ]); AttendanceTracking::query()->create([ 'student_id' => 1, 'date' => now(), 'is_reported' => 1, 'reason' => 'ABS_2', 'semester' => 'Fall', 'school_year' => '2025-2026', ]); $email = Mockery::mock(EmailService::class); $email->shouldReceive('send')->once()->andReturn(true); $notifier = Mockery::mock(UserNotificationDispatchService::class); $notifier->shouldReceive('notifyUser')->once(); $service = new AttendanceConsequenceService($email, $notifier); $result = $service->sendFollowUp([ 'student_id' => 1, 'parent' => ['email' => 'parent@example.com', 'user_id' => 5], 'student' => ['firstname' => 'A', 'lastname' => 'B'], 'tracking_id' => 1, 'html' => '
Test
', ]); $this->assertTrue($result['ok']); $this->assertDatabaseHas('attendance_tracking', [ 'id' => 1, 'is_notified' => 1, ]); } }