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 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]

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: 290 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.