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

Don't assume there are no existing scales

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      • Edit mod/wiki/db/install.php
      • Add "make_default_scale();" into the install function in that file.
      • Re-init phpunit so the scale gets installed.
      • Run vendor/bin/phpunit competency/tests/external_test.php (or the full moodle test unit test suite)
      • Without the patch, you'll get a bunch of errors
      • With the patch, you'll get a passing test suite.
      Show
      Edit mod/wiki/db/install.php Add "make_default_scale();" into the install function in that file. Re-init phpunit so the scale gets installed. Run vendor/bin/phpunit competency/tests/external_test.php (or the full moodle test unit test suite) Without the patch, you'll get a bunch of errors With the patch, you'll get a passing test suite.
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Every time a unit test for competencies adds a scale, it's creating them with hardcoded id's - which should always be avoided.

      As a bunch of the tests attempt to create new scales with an id = 1 throughout its tests, if any 3rd party plugin in your Moodle instance has added a scale as part of the installation process, this will cause duplicate index errors.

      Unit tests should rarely, if ever, use hardcoded record id's like this.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aolley Adam Olley
              Reporter:
              aolley Adam Olley
              Peer reviewer:
              Frédéric Massart
              Integrator:
              David Monllaó
              Tester:
              Mark Nelson
              Participants:
              Component watchers:
              Damyon Wiese, Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                23/May/16