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.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]

Test helpers for the essay question type.

Copyright: 2013 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 295 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: qtype_essay_test_helper  - X-Ref

Test helper class for the essay question type.

get_test_questions()   X-Ref
No description

initialise_essay_question()   X-Ref
Helper method to reduce duplication.

return: qtype_essay_question

make_essay_question_editor()   X-Ref
Makes an essay question using the HTML editor as input.

return: qtype_essay_question

get_essay_question_form_data_editor()   X-Ref
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: stdClass the data that would be returned by $form->get_gata();

make_essay_question_editorfilepicker()   X-Ref
Makes an essay question using the HTML editor allowing embedded files as
input, and up to three attachments.

return: qtype_essay_question

make_essay_question_editorfilepickertworequired()   X-Ref
Makes an essay question using the HTML editor allowing embedded files as
input, and up to two attachments, two needed.

return: qtype_essay_question

get_essay_question_form_data_editorfilepicker()   X-Ref
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: stdClass the data that would be returned by $form->get_gata();

make_essay_question_plain()   X-Ref
Makes an essay question using plain text input.

return: qtype_essay_question

get_essay_question_form_data_plain()   X-Ref
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: stdClass the data that would be returned by $form->get_gata();

make_essay_question_monospaced()   X-Ref
Makes an essay question using monospaced input.

return: qtype_essay_question

make_essay_question_responsetemplate()   X-Ref
No description

make_essay_question_noinline()   X-Ref
Makes an essay question without an online text editor.

return: qtype_essay_question

make_attachment_draft_area()   X-Ref
Creates an empty draft area for attachments.

return: int The draft area's itemid.

make_attachment($draftid, $name, $contents)   X-Ref
Creates an attachment in the provided attachment draft area.

param: int $draftid The itemid for the draft area in which the file should be created.
param: string $name The filename for the file to be created.
param: string $contents The contents of the file to be created.

make_attachments($attachments)   X-Ref
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.

param: int $attachments The number of attachments to generate.
return: int The itemid of the generated draft file area.

make_attachments_saver($attachments)   X-Ref
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.

param: int $:attachments The number of attachments to generate.
return: question_file_saver a question_file_saver that contains the given amount of dummy files, for use in testing.