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:
    • Testing Instructions:
      Hide
      1. Apply the attached patch:

        git am 0001-TEST-ONLY.patch
        

      2. Drop phpunit and re-init

        php admin/tool/phpunit/cli/util.php --drop
        php admin/tool/phpunit/cli/init.php
        

      3. Run PHPUnit

        php ./vendor/bin/phpunit
        

        1. Confirm that the only failures are in accesslib_test.php (there are three)
      Show
      Apply the attached patch: git am 0001-TEST-ONLY.patch Drop phpunit and re-init php admin/tool/phpunit/cli/util.php --drop php admin/tool/phpunit/cli/init.php Run PHPUnit php ./vendor/bin/phpunit Confirm that the only failures are in accesslib_test.php (there are three)
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE
    • Pull Master Branch:
      MDL-63842-master

      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

            Assignee:
            dobedobedoh Andrew Lyons
            Reporter:
            aurelienb Aurélien Besson
            Peer reviewer:
            Peter Dias Peter Dias
            Integrator:
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Tester:
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Participants:
            Component watchers:
            Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

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