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

Don't assume there are no existing scales

    XMLWordPrintable

Details

    • MOODLE_31_STABLE
    • MOODLE_31_STABLE
    • 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.

    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

              aolley Adam Olley
              aolley Adam Olley
              Frédéric Massart Frédéric Massart
              David Monllaó David Monllaó
              Mark Nelson Mark Nelson
              Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                23/May/16