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

Unit test - userlib_test failed - due to role without archetype

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.4.7, 3.5.4
    • 3.4.5, 3.5.3, 3.6
    • Unit tests
    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MDL-63842-master
    • 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)

      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');
      

            dobedobedoh Andrew Lyons
            aurelienb Aurélien Besson
            Peter Dias Peter Dias
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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