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

Unit test - userlib_test failed - due to role without archetype

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.5, 3.5.3, 3.6
    • Fix Version/s: 3.4.7, 3.5.4
    • Component/s: Unit tests
    • Labels:

      Description

      This test fail with Adobe Connect plugin installed

      In the code in user/tests/userlib_test.php (ln 600) 

      $allroles = $DB->get_records_menu('role', array(), 'id', 'archetype, id'); 
      

      $allroles contains :

      [manager] => 1,
      [coursecreator] => 2,
      [editingteacher] => 3,
      [teacher]=> 4,
      [student] => 5,
      [guest] => 6,
      [user] => 7,
      [frontpage] => 8,
      []=> 11
      

      As Adobe Connect add 3 new roles with no archetype, the result contain an empty key with value 11 (8 archetype + 3 new provide by Adobe Connect without archetype) and this is cause an error.

       core_userliblib_testcase::test_user_can_view_profile
      Unexpected debugging() call detected.
      Debugging: Did you remember to make the first column something unique in your call to get_records? Duplicate value '' found in column 'archetype'.
      

      i propose to change for

      $allroles = $DB->get_records_menu('role', array(), 'id', 'shortname, id');
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Jan/19