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

            timhunt Tim Hunt
            timhunt Tim Hunt
            Sam Marshall Sam Marshall
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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

                Clockify

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