Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
qtype_essay_test_helper Class Reference

Test helper class for the essay question type. More...

Inheritance diagram for qtype_essay_test_helper:

Public Member Functions

 get_essay_question_form_data_editor ()
 Make the data what would be received from the editing form for an essay question using the HTML editor allowing embedded files as input, and up to three attachments.
 
 get_essay_question_form_data_editorfilepicker ()
 Make the data what would be received from the editing form for an essay question using the HTML editor allowing embedded files as input, and up to three attachments.
 
 get_essay_question_form_data_plain ()
 Make the data what would be received from the editing form for an essay question using the HTML editor allowing embedded files as input, and up to three attachments.
 
 get_test_questions ()
 
 make_attachments ($attachments)
 Generates a draft file area that contains the provided number of attachments.
 
 make_attachments_saver ($attachments)
 Generates a question_file_saver that contains the provided number of attachments.
 
 make_essay_question_editor ()
 Makes an essay question using the HTML editor as input.
 
 make_essay_question_editorfilepicker ()
 Makes an essay question using the HTML editor allowing embedded files as input, and up to three attachments.
 
 make_essay_question_editorfilepickertworequired ()
 Makes an essay question using the HTML editor allowing embedded files as input, and up to two attachments, two needed.
 
 make_essay_question_monospaced ()
 Makes an essay question using monospaced input.
 
 make_essay_question_noinline ()
 Makes an essay question without an online text editor.
 
 make_essay_question_plain ()
 Makes an essay question using plain text input.
 
 make_essay_question_responsetemplate ()
 

Static Public Member Functions

static get_question_editing_form ($cat, $questiondata)
 Set up a form to create a question in $cat.
 

Protected Member Functions

 initialise_essay_question ()
 Helper method to reduce duplication.
 
 make_attachment ($draftid, $name, $contents)
 Creates an attachment in the provided attachment draft area.
 
 make_attachment_draft_area ()
 Creates an empty draft area for attachments.
 

Detailed Description

Test helper class for the essay question type.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_essay_question_form_data_editor()

qtype_essay_test_helper::get_essay_question_form_data_editor ( )

Make the data what would be received from the editing form for an essay question using the HTML editor allowing embedded files as input, and up to three attachments.

Return values
stdClassthe data that would be returned by $form->get_gata();

◆ get_essay_question_form_data_editorfilepicker()

qtype_essay_test_helper::get_essay_question_form_data_editorfilepicker ( )

Make the data what would be received from the editing form for an essay question using the HTML editor allowing embedded files as input, and up to three attachments.

Return values
stdClassthe data that would be returned by $form->get_gata();

◆ get_essay_question_form_data_plain()

qtype_essay_test_helper::get_essay_question_form_data_plain ( )

Make the data what would be received from the editing form for an essay question using the HTML editor allowing embedded files as input, and up to three attachments.

Return values
stdClassthe data that would be returned by $form->get_gata();

◆ get_question_editing_form()

static question_test_helper::get_question_editing_form ( $cat,
$questiondata )
staticinherited

Set up a form to create a question in $cat.

This method also sets cat and contextid on $questiondata object.

Parameters
object$catthe category
object$questiondataform initialisation requires question data.
Return values
moodleform

◆ get_test_questions()

qtype_essay_test_helper::get_test_questions ( )
Return values
arrayof example question names that can be passed as the $which argument of test_question_maker::make_question when $qtype is this question type.

Reimplemented from question_test_helper.

◆ initialise_essay_question()

qtype_essay_test_helper::initialise_essay_question ( )
protected

Helper method to reduce duplication.

Return values
qtype_essay_question

◆ make_attachment()

qtype_essay_test_helper::make_attachment ( $draftid,
$name,
$contents )
protected

Creates an attachment in the provided attachment draft area.

Parameters
int$draftidThe itemid for the draft area in which the file should be created.
string$nameThe filename for the file to be created.
string$contentsThe contents of the file to be created.

◆ make_attachment_draft_area()

qtype_essay_test_helper::make_attachment_draft_area ( )
protected

Creates an empty draft area for attachments.

Return values
intThe draft area's itemid.

◆ make_attachments()

qtype_essay_test_helper::make_attachments ( $attachments)

Generates a draft file area that contains the provided number of attachments.

You should ensure that a user is logged in with setUser before you run this function.

Parameters
int$attachmentsThe number of attachments to generate.
Return values
intThe itemid of the generated draft file area.

◆ make_attachments_saver()

qtype_essay_test_helper::make_attachments_saver ( $attachments)

Generates a question_file_saver that contains the provided number of attachments.

You should ensure that a user is logged in with setUser before you run this function.

Parameters
int$:attachments The number of attachments to generate.
Return values
question_file_savera question_file_saver that contains the given amount of dummy files, for use in testing.

◆ make_essay_question_editor()

qtype_essay_test_helper::make_essay_question_editor ( )

Makes an essay question using the HTML editor as input.

Return values
qtype_essay_question

◆ make_essay_question_editorfilepicker()

qtype_essay_test_helper::make_essay_question_editorfilepicker ( )

Makes an essay question using the HTML editor allowing embedded files as input, and up to three attachments.

Return values
qtype_essay_question

◆ make_essay_question_editorfilepickertworequired()

qtype_essay_test_helper::make_essay_question_editorfilepickertworequired ( )

Makes an essay question using the HTML editor allowing embedded files as input, and up to two attachments, two needed.

Return values
qtype_essay_question

◆ make_essay_question_monospaced()

qtype_essay_test_helper::make_essay_question_monospaced ( )

Makes an essay question using monospaced input.

Return values
qtype_essay_question

◆ make_essay_question_noinline()

qtype_essay_test_helper::make_essay_question_noinline ( )

Makes an essay question without an online text editor.

Return values
qtype_essay_question

◆ make_essay_question_plain()

qtype_essay_test_helper::make_essay_question_plain ( )

Makes an essay question using plain text input.

Return values
qtype_essay_question

The documentation for this class was generated from the following file: