Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-61407

Implement providers for mod_quiz

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Unit tests cover a lot of this change, but the more complex things are not easy to unit test.

      Setup
      1. Create a category and course structure like:

        /Cat1 [category]
        /Cat1/Cat1b [category]
        /Cat1/Cat1b/C1 [course]
        /Cat2 [category]
        /Cat2/Cat2b [category]
        /Cat2/Cat2b/C2 [course]
        

      2. Enrol two users in both courses as teachers (T1, T2)
      3. Enrol two users in both courses as students (S1, S2)
      4. Login as T1
      5. Create a quiz with questions of different types in both courses:
        1. Place questions in both the Course, and both of the parent course categories
        2. Include at least one essay question, one true/false question, one short answer, and any others you fancy.
      6. Login as T2
      7. Update all of the questions in the first course.
      8. Do not update any questions in the second course
      9. Remove all access to the first course for T1
      10. Login as S1
      11. Complete the quizzes in both courses
        1. Ensure that you attach at least one file in the essay question.
      12. Attempt the course in the second course several more times
      13. Login as S2
      14. Complete the quiz in the first course only
      15. Remove all access to the first course for S2
      16. Login as T2
      17. Mark the essay questions:
        1. leave a comment for the latest attempts in the second course
        2. On master also attach a file,
      18. Edit the existing comment and add another file.
      A test to ensure that multiple attempts are both exported
      1. Run the attached testfinal.php for the 'S1' user.
      2. View the exported output
      3. Find C1 in the output
        1. Confirm that the quiz has attempts for each time you attempted the quiz
        2. Confirm that each quiz attempt has an appropriate data.json which includes:
          1. relevant time fields (none should show a date in 1970)
          2. the relevant state of the quiz
        3. Confirm that all of the questions in the quiz are represented in each attempt
        4. Confirm that the files you attached when submitting are present for the relevant question
        5. Confirm that the files you attached when marking are present
      4. Open the data.json for each question and pass it through your preferred JSON formatter:
        1. Confirm that the following fields are represented appropriately:
          1. name - the name of the question
          2. question - the question text
          3. answer - the answer that you gave
          4. mark - the mark that was awarded for this question (depending on whether it was correct or not)
          5. flagged - whether the question was flagged
          6. generalfeedback - Any general feedback configured on this question
      5. Open the steps.json for each question:
        1. Confirm that the following fields are represented appropriately:
          1. time - The time of the change
          2. action - a human-readable description of the change
          3. state - a descriptio of the question state
          4. mark - any mark awarded
      6. Find C2 in the output
        1. Confirm that the quiz has one attempt
        2. Confirm that the quiz attempt has an appropriate data.json
        3. Confirm that all of the questions in the quiz are represented in each attempt
        4. Confirm that the files you attached when submitting are present for the relevant question
        5. Confirm that the files you attached when marking are present
        6. Confirm that the steps.json is correct for each question
        7. Confirm that the data.json is correct for each question
      Questions that the user created and no longer has access to (all roles removed)
      1. Repeat the export for user S2 with the same confirmations
        1. All of the quizzes and attempts should be present
      Confirmations as the creator of the questions
      1. Run the exporter as T1
      2. View the exported output
        1. Confirm that the data exists for the following course categories, and courses:
          1. /Cat1
          2. /Cat1/Cat1b
          3. /Cat1/Cat1b/C1
          4. /Cat2
          5. /Cat2/Cat2b
          6. /Cat2/Cat2b/C2
        2. Confirm that each of them has a Question bank folder
      3. For each of the question bank folders:
        1. Confirm that each has a questions.xml
        2. Confirm that the relevant questions were all included in the XML file
      4. Run the exports as T2
      5. Repeat the confirmations but only confirming that data exists for the following:
          1. /Cat1
          2. /Cat1/Cat1b
          3. /Cat1/Cat1b/C1
      Attempts where the mark is hidden
      1. Login as T1
      2. Navigate to one of the quizzes and edit the settings
      3. Expand "Review options"
        1. Unset all of checkmarks
      4. Save and display
      5. Run the export for S1
      6. Find the quiz you modified in the output
      7. Open the various data.json and steps.json files
        1. Confirm that there is no information regarding the marks, or correctness of the attempt
      Show
      Unit tests cover a lot of this change, but the more complex things are not easy to unit test. Setup Create a category and course structure like: /Cat1 [category] /Cat1/Cat1b [category] /Cat1/Cat1b/C1 [course] /Cat2 [category] /Cat2/Cat2b [category] /Cat2/Cat2b/C2 [course] Enrol two users in both courses as teachers (T1, T2) Enrol two users in both courses as students (S1, S2) Login as T1 Create a quiz with questions of different types in both courses: Place questions in both the Course, and both of the parent course categories Include at least one essay question, one true/false question, one short answer, and any others you fancy. Login as T2 Update all of the questions in the first course. Do not update any questions in the second course Remove all access to the first course for T1 Login as S1 Complete the quizzes in both courses Ensure that you attach at least one file in the essay question. Attempt the course in the second course several more times Login as S2 Complete the quiz in the first course only Remove all access to the first course for S2 Login as T2 Mark the essay questions: leave a comment for the latest attempts in the second course On master also attach a file, Edit the existing comment and add another file. A test to ensure that multiple attempts are both exported Run the attached testfinal.php for the 'S1' user. View the exported output Find C1 in the output Confirm that the quiz has attempts for each time you attempted the quiz Confirm that each quiz attempt has an appropriate data.json which includes: relevant time fields (none should show a date in 1970) the relevant state of the quiz Confirm that all of the questions in the quiz are represented in each attempt Confirm that the files you attached when submitting are present for the relevant question Confirm that the files you attached when marking are present Open the data.json for each question and pass it through your preferred JSON formatter: Confirm that the following fields are represented appropriately: name - the name of the question question - the question text answer - the answer that you gave mark - the mark that was awarded for this question (depending on whether it was correct or not) flagged - whether the question was flagged generalfeedback - Any general feedback configured on this question Open the steps.json for each question: Confirm that the following fields are represented appropriately: time - The time of the change action - a human-readable description of the change state - a descriptio of the question state mark - any mark awarded Find C2 in the output Confirm that the quiz has one attempt Confirm that the quiz attempt has an appropriate data.json Confirm that all of the questions in the quiz are represented in each attempt Confirm that the files you attached when submitting are present for the relevant question Confirm that the files you attached when marking are present Confirm that the steps.json is correct for each question Confirm that the data.json is correct for each question Questions that the user created and no longer has access to (all roles removed) Repeat the export for user S2 with the same confirmations All of the quizzes and attempts should be present Confirmations as the creator of the questions Run the exporter as T1 View the exported output Confirm that the data exists for the following course categories, and courses: /Cat1 /Cat1/Cat1b /Cat1/Cat1b/C1 /Cat2 /Cat2/Cat2b /Cat2/Cat2b/C2 Confirm that each of them has a Question bank folder For each of the question bank folders: Confirm that each has a questions.xml Confirm that the relevant questions were all included in the XML file Run the exports as T2 Repeat the confirmations but only confirming that data exists for the following: /Cat1 /Cat1/Cat1b /Cat1/Cat1b/C1 Attempts where the mark is hidden Login as T1 Navigate to one of the quizzes and edit the settings Expand " Review options " Unset all of checkmarks Save and display Run the export for S1 Find the quiz you modified in the output Open the various data.json and steps.json files Confirm that there is no information regarding the marks, or correctness of the attempt
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull Master Branch:
      MDL-61407-master

      Description

      Attempt to write mod_quiz providers for the in-progress SAR API.

        Attachments

        1. 1.PNG
          1.PNG
          296 kB
        2. 2.PNG
          2.PNG
          190 kB
        3. 3.PNG
          3.PNG
          66 kB
        4. Capture.PNG
          Capture.PNG
          66 kB
        5. image-2018-05-07-13-12-33-338.png
          image-2018-05-07-13-12-33-338.png
          29 kB
        6. image-2018-05-07-13-13-49-243.png
          image-2018-05-07-13-13-49-243.png
          429 kB
        7. test.php
          2 kB
        8. testfinal.php
          2 kB

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/18

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 30 minutes
                4h 30m