Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.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.