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

    Details

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jamiesensei Jamie Pratt
              Reporter:
              jamiesensei Jamie Pratt
              Peer reviewer:
              Colin Chambers
              Integrator:
              Damyon Wiese
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                18/Nov/13