Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 310]

Quiz module external functions tests.

Copyright: 2016 Juan Leyva <juan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1951 lines (89 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes


Class: testable_mod_quiz_external  - X-Ref

Silly class to access mod_quiz_external internal methods.

validate_attempt($params, $checkaccessrules = true, $failifoverdue = true)   X-Ref
Public accessor.

param: array $params Array of parameters including the attemptid and preflight data
param: bool $checkaccessrules whether to check the quiz access rules or not
param: bool $failifoverdue whether to return error if the attempt is overdue
return: array containing the attempt object and access messages

validate_attempt_review($params)   X-Ref
Public accessor.

param: array $params Array of parameters including the attemptid
return: array containing the attempt object and display options

Class: mod_quiz_external_testcase  - X-Ref

Quiz module external functions tests

setUp()   X-Ref
Set up for every test


create_quiz_with_questions($startattempt = false, $finishattempt = false, $behaviour = 'deferredfeedback',$includeqattachments = false, $extraoptions = [])   X-Ref
Create a quiz with questions including a started or finished attempt optionally

param: boolean $startattempt whether to start a new attempt
param: boolean $finishattempt whether to finish the new attempt
param: string $behaviour the quiz preferredbehaviour, defaults to 'deferredfeedback'.
param: boolean $includeqattachments whether to include a question that supports attachments, defaults to false.
param: array $extraoptions extra options for Quiz.
return: array array containing the quiz, context and the attempt

test_mod_quiz_get_quizzes_by_courses()   X-Ref
No description

test_view_quiz()   X-Ref
Test test_view_quiz


test_get_user_attempts()   X-Ref
Test get_user_attempts


test_get_user_attempts_with_marks_hidden()   X-Ref
Test get_user_attempts with marks hidden


test_get_user_best_grade()   X-Ref
Test get_user_best_grade


test_get_combined_review_options()   X-Ref
Test get_combined_review_options.
This is a basic test, this is already tested in mod_quiz_display_options_testcase.


test_start_attempt()   X-Ref
Test start_attempt


test_validate_attempt()   X-Ref
Test validate_attempt


test_get_attempt_data()   X-Ref
Test get_attempt_data


test_get_attempt_data_with_blocked_questions()   X-Ref
Test get_attempt_data with blocked questions.


test_get_attempt_summary()   X-Ref
Test get_attempt_summary


test_save_attempt()   X-Ref
Test save_attempt


test_process_attempt()   X-Ref
Test process_attempt


test_validate_attempt_review()   X-Ref
Test validate_attempt_review


test_get_attempt_review()   X-Ref
Test get_attempt_review


test_view_attempt()   X-Ref
Test test_view_attempt


test_view_attempt_summary()   X-Ref
Test test_view_attempt_summary


test_view_attempt_review()   X-Ref
Test test_view_attempt_summary


test_get_quiz_feedback_for_grade()   X-Ref
Test get_quiz_feedback_for_grade


test_get_quiz_access_information()   X-Ref
Test get_quiz_access_information


test_get_attempt_access_information()   X-Ref
Test get_attempt_access_information


test_get_quiz_required_qtypes()   X-Ref
Test get_quiz_required_qtypes