Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Class: targets_test  - X-Ref

Unit tests for core targets.

analysable_provider()   X-Ref
Provides course params for the {@link self::test_core_target_course_completion_analysable()} method.

return: array

sample_provider()   X-Ref
Provides enrolment params for the {@link self::test_core_target_course_completion_samples()} method.

return: array

active_during_analysis_time_provider()   X-Ref
Provides enrolment params for the {@link self::test_core_target_course_completion_samples()} method.

return: array

test_core_target_course_completion_analysable($courseparams, $isvalid, $fortraining = true)   X-Ref
Test the conditions of a valid analysable, both common and specific to this target (course_completion).

param: mixed $courseparams Course data
param: true|string $isvalid True when analysable is valid, string when it is not
param: boolean $fortraining True if the course is for training the model

test_core_target_course_completion_samples($coursestart, $courseend, $timestart, $timeend,$isvalidfortraining, $isvalidforprediction)   X-Ref
Test the conditions of a valid sample, both common and specific to this target (course_completion).

param: int $coursestart Course start date
param: int $courseend Course end date
param: int $timestart Enrol start date
param: int $timeend Enrol end date
param: boolean $isvalidfortraining True when sample is valid for training, false when it is not
param: boolean $isvalidforprediction True when sample is valid for prediction, false when it is not

test_core_target_course_completion_active_during_analysis_time($starttime, $endtime, $timestart, $timeend,$nullcalculation)   X-Ref
Test the conditions of a valid calculation (course_completion).

param: int $starttime Analysis start time
param: int $endtime Analysis end time
param: int $timestart Enrol start date
param: int $timeend Enrol end date
param: boolean $nullcalculation Whether the calculation should be null or not

setup_competencies_environment()   X-Ref
Setup user, framework, competencies and course competencies.


test_core_target_course_competencies_analysable()   X-Ref
Test the specific conditions of a valid analysable for the course_competencies target.


test_core_target_course_competencies_calculate()   X-Ref
Test the target value calculation.


test_core_target_course_gradetopass_analysable()   X-Ref
Test the specific conditions of a valid analysable for the course_gradetopass target.


test_core_target_course_gradetopass_calculate()   X-Ref
Test the target value calculation of the course_gradetopass target.