createMock(UserModel::class); $userModel->expects($this->once()) ->method('find') ->with(12) ->willReturn([ 'firstname' => 'Parent', 'lastname' => 'One', 'email' => 'parent@example.test', ]); $studentModel = $this->createMock(StudentModel::class); $studentModel->expects($this->once()) ->method('find') ->with(34) ->willReturn([ 'id' => 34, 'firstname' => 'Student', 'lastname' => 'One', ]); $emailService = $this->createMock(EmailService::class); $emailService->expects($this->once()) ->method('send') ->with( 'registration@example.test', 'New Student Registered: Student One', $this->stringContains('emails/admin_student_registered'), 'notifications' ) ->willReturn(true); $service = new ParentRegistrationNotificationService( $userModel, $studentModel, $emailService, 'registration@example.test' ); $service->sendAdminNewStudentEmails([34], 12); } } }