-
Improvement
-
Resolution: Fixed
-
Minor
-
2.5
-
MOODLE_25_STABLE
-
MOODLE_24_STABLE, MOODLE_25_STABLE
-
wip_
MDL-40176_v4 -
A mock_submit method should make the form behave as if a submit button has been pressed and get_data should then return all the values as passed into the form from set_data and setDefault etc. So that we could perform the following integration test for example :
$questiondata = test_question_maker::get_question_data('multichoice', 'single');
|
$expectedfromform = test_question_maker::get_question_form_data('multichoice', 'single');
|
$form = new qtype_multichoice_edit_form(...);
|
$form->set_data($questiondata);
|
$form->mock_submit();
|
$actualfromform = $form->get_data();
|
$this->assertEquals($expectedfromform, $actualfromform);
|
save_question($actualfromform);
|
$actualquestiondata = question_load_questions(array($actualfromform->id));
|
$this->assertEquals($questiondata, $actualquestiondata);
|