Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Class: locallib_test  - X-Ref

Unit tests for (some of) mod/quiz/locallib.php.

test_quiz_rescale_grade()   X-Ref
No description

quiz_attempt_state_data_provider()   X-Ref
No description

test_quiz_attempt_state($attemptstate,$relativetimefinish, $relativetimeclose, $expectedstate)   X-Ref

param: unknown $attemptstate as in the quiz_attempts.state DB column.
param: unknown $relativetimefinish time relative to now when the attempt finished, or null for 0.
param: unknown $relativetimeclose time relative to now when the quiz closes, or null for 0.
param: unknown $expectedstate expected result. One of the mod_quiz_display_options constants/

test_quiz_question_tostring()   X-Ref


test_quiz_question_tostring_does_not_filter()   X-Ref


test_quiz_view()   X-Ref
Test quiz_view

return: void

test_quiz_is_overriden_calendar_event_no_override()   X-Ref
Return false when there are not overrides for this quiz instance.


test_quiz_is_overriden_calendar_event_no_module_event()   X-Ref
Return false if the given event isn't an quiz module event.


test_quiz_is_overriden_calendar_event_different_quiz_instance()   X-Ref
Return false if there is overrides for this use but they belong to another quiz
instance.


test_quiz_is_overriden_calendar_event_user_override()   X-Ref
Return true if there is a user override for this event and quiz instance.


test_quiz_is_overriden_calendar_event_group_override()   X-Ref
Return true if there is a group override for the event and quiz instance.


test_quiz_get_user_timeclose()   X-Ref
Test test_quiz_get_user_timeclose().


setup_quiz_and_tags($qnum, $randomqnum, $questiontags = [], $unusedtags = [])   X-Ref
This function creates a quiz with some standard (non-random) and some random questions.
The standard questions are created first and then random questions follow them.
So in a quiz with 3 standard question and 2 random question, the first random question is at slot 4.

param: int $qnum Number of standard questions that should be created in the quiz.
param: int $randomqnum Number of random questions that should be created in the quiz.
param: array $questiontags Tags to be used for random questions.
param: string[] $unusedtags Some additional tags to be created.
return: array An array of 2 elements: $quiz and $tagobjects.

test_quiz_override_summary()   X-Ref
No description

test_quiz_send_confirmation()   X-Ref
Test quiz_send_confirmation function.