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

Behat: And the following "question categories" exist: does not look up parent category intelligently

    XMLWordPrintable

    Details

      Description

      The behat step: (e.g. from question/tests/behat/question_categories.feature)

          And the following "question categories" exist:
            | contextlevel | reference | questioncategory | name           |
            | Course       | C1        | Top              | top            |
            | Course       | C1        | top              | Default for C1 |
            | Course       | C1        | Default for C1   | Subcategory    |
            | Course       | C1        | top              | Used category  |
      

      is not very intelligent. When it looks up 'questioncategory' (the parent category) then it just searches by name. Unforunately, every context in Moodle gets a category called 'top'.

      Amazingly, this does not normally cause problems, because the top categories are only created on-demand, and if your test only involves the question bank in one context, it works.

      Except ... if you have qtype_coderunner installed. If you do, then as part of its install, it causes the 'top' cateogry in the system context to appear, and then all sorts of Behat tests start failing.

      So, when looking up the parent questioncategory, it should pay attention to the values in the contextlevel & reference columns, and only consider categories in the same context.

        Attachments

          Activity

            People

            • Assignee:
              timhunt Tim Hunt
              Reporter:
              timhunt Tim Hunt
              Peer reviewer:
              Sam Marshall
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Gladys Basiana
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Nov/19

                Time Tracking

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