diff --git a/question/format/gift/format.php b/question/format/gift/format.php index b23b8c88cdd..7aa95f2b712 100644 --- a/question/format/gift/format.php +++ b/question/format/gift/format.php @@ -317,10 +317,11 @@ class qformat_gift extends qformat_default { return $question; case ESSAY: - $question->fraction = 0; - $question->feedback['text'] = ''; - $question->feedback['format'] = $question->questiontextformat; - $question->feedback['files'] = array(); + $question->responseformat = 'editor'; + $question->responsefieldlines = 15; + $question->attachments = 0; + $question->graderinfo = array( + 'text' => '', 'format' => FORMAT_HTML, 'files' => array()); return $question; case MULTICHOICE: diff --git a/question/format/gift/simpletest/fixtures/questions.gift.txt b/question/format/gift/simpletest/fixtures/questions.gift.txt new file mode 100644 index 00000000000..e7ad9a611a6 --- /dev/null +++ b/question/format/gift/simpletest/fixtures/questions.gift.txt @@ -0,0 +1,48 @@ +// essay +::Q8:: How are you? {} + +// question: 2 name: Moodle activities +::Moodle activities::[html]Match the activity to the description.{ + =[html]An activity supporting asynchronous discussions. -> Forum + =[moodle]A teacher asks a question and specifies a choice of multiple responses. -> Choice + =[plain]A bank of record entries which participants can add to. -> Database + =[markdown]A collection of web pages that anyone can add to or edit. -> Wiki + = -> Chat +} + +// multiple choice with specified feedback for right and wrong answers +::Q2:: What's between orange and green in the spectrum? +{ + =yellow # right; good! + ~red # [html]wrong, it's yellow + ~[plain]blue # wrong, it's yellow +} + +// multiple choice, multiple response with specified feedback for right and wrong answers +::colours:: What's between orange and green in the spectrum? +{ + ~%50%yellow # right; good! + ~%-100%red # [html]wrong + ~%50%off-beige # right; good! + ~%-100%[plain]blue # wrong +} + +// math range question +::Q5:: What is a number from 1 to 5? {#3:2~#Completely wrong}"; + +// question: 666 name: Shortanswer +::Shortanswer::Which is the best animal?{ + =Frog#Good! + =%50%Cat#What is it with Moodlers and cats? + =%0%*#Completely wrong +} + +// true/false +::Q1:: 42 is the Absolute Answer to everything.{ +FALSE#42 is the Ultimate Answer.#You gave the right answer.}"; + +// name 0-11 +::2-08 TSL::TSL is blablabla.{T} + +// name 0-11 +::2-08 TSL::TSL is blablabla.{TRUE} diff --git a/question/format/gift/simpletest/testgiftformat.php b/question/format/gift/simpletest/testgiftformat.php index f44f9401a92..2238fc6c237 100644 --- a/question/format/gift/simpletest/testgiftformat.php +++ b/question/format/gift/simpletest/testgiftformat.php @@ -62,11 +62,13 @@ class qformat_gift_test extends UnitTestCase { 'defaultmark' => 1, 'penalty' => 0.3333333, 'length' => 1, - 'feedback' => array( + 'responseformat' => 'editor', + 'responsefieldlines' => 15, + 'attachments' => 0, + 'graderinfo' => array( 'text' => '', - 'format' => FORMAT_MOODLE, - 'files' => array(), - ), + 'format' => FORMAT_HTML, + 'files' => array()), ); $this->assert(new CheckSpecifiedFieldsExpectation($expectedq), $q); @@ -85,16 +87,11 @@ class qformat_gift_test extends UnitTestCase { 'length' => 1, 'qtype' => 'essay', 'options' => (object) array( - 'answers' => array( - 123 => (object) array( - 'id' => 123, - 'answer' => 666, - 'answerformat' => FORMAT_MOODLE, - 'fraction' => 0, - 'feedback' => '', - 'feedbackformat' => FORMAT_MOODLE, - ), - ), + 'responseformat' => 'editor', + 'responsefieldlines' => 15, + 'attachments' => 0, + 'graderinfo' => '', + 'graderinfoformat' => FORMAT_HTML, ), );