Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-40070 Unit tests for quiz statistics report
  3. MDL-40171

Test question editing forms and question saving

XMLWordPrintable

      Add a unit test like :

      $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(); // I don't think this exists but it could.
      $actualfromform = $form->get_data();
      $this->assertEquals($expectedfromform, $actualfromform);
      save_question($actualfromform);
      $actualquestiondata = question_load_questions(array($actualfromform->id));
      $this->assertEquals($questiondata, $actualquestiondata);
      

      To all the existing question types. That would test the save_question_options / get_question_options code that is currently not tested.

            jamiesensei Jamie Pratt (Inactive)
            jamiesensei Jamie Pratt (Inactive)
            Colin Chambers Colin Chambers (Inactive)
            Damyon Wiese Damyon Wiese
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.