[ Index ]

PHP Cross Reference of Moodle 310

title

Body

[close]

/mod/quiz/tests/generator/ -> lib.php (summary)

(no description)

File Size: 196 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

mod_quiz_generator:: (4 methods):
  create_instance()
  create_attempt()
  submit_responses()
  create_override()


Class: mod_quiz_generator  - X-Ref

Quiz module test data generator class

create_instance($record = null, array $options = null)   X-Ref
No description

create_attempt($quizid, $userid, array $forcedrandomquestions = [],array $forcedvariants = [])   X-Ref
Create a quiz attempt for a particular user at a particular course.

Currently this method can only create a first attempt for each
user at each quiz. TODO remove this limitation.

param: int $quizid the quiz id (from the mdl_quit table, not cmid).
param: int $userid the user id.
param: array $forcedrandomquestions slot => questionid. Optional,
param: array $forcedvariants slot => variantno. Optional. Optional,
return: stdClass the new attempt.

submit_responses($attemptid, array $responses, $checkbutton, $finishattempt)   X-Ref
Submit responses to a quiz attempt.

To be realistic, you should ensure that $USER is set to the user whose attempt
it is before calling this.

param: int $attemptid the id of the attempt which is being
param: array $responses array responses to submit. See description on
param: bool $checkbutton if simulate a click on the check button for each question, else simulate save.
param: bool $finishattempt if true, the attempt will be submitted.

create_override(array $data)   X-Ref
Create a quiz override (either user or group).

param: array $data must specify quizid, and one of userid or groupid.



Generated: Wed Jan 22 11:59:49 2025 Cross-referenced by PHPXref 0.7.1