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

qbank unit test error with comments api

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-72843-qbank_comment-unit-testsuite-resolve
    • Hide

       

      To reproduce:
      Run the PHPUnit init:
      php admin/tool/phpunit/cli/init.php

      Run the testsuite for qbank_previewquestion:
      vendor/bin/phpunit --testsuite qbank_previewquestion_testsuite

      Same goes for comment:

      vendor/bin/phpunit --testsuite qbank_comment_testsuite

      You should get the errors:

      {{1) qbank_comment_backup_restore_test::test_backup_restore
      Error: Class 'comment' not found}}

       {{1) qbank_previewquestion\qbank_preview_helper_test::test_get_preview_extra_elements
      Error: Class 'comment' not found}}{{}}

       

      Apply patch and retest. Errors should not appear

      Show
        To reproduce: Run the PHPUnit init: php admin/tool/phpunit/cli/init.php Run the testsuite for qbank_previewquestion: vendor/bin/phpunit --testsuite qbank_previewquestion_testsuite Same goes for comment: vendor/bin/phpunit --testsuite qbank_comment_testsuite You should get the errors: {{1) qbank_comment_backup_restore_test::test_backup_restore Error: Class 'comment' not found}}  {{1) qbank_previewquestion\qbank_preview_helper_test::test_get_preview_extra_elements Error: Class 'comment' not found}}{{}}   Apply patch and retest. Errors should not appear

    Description

      Qbank previewquestion and comment unit test fails while the individual testsuite runs. There are two errors:

       

      {{1) qbank_comment_backup_restore_test::test_backup_restore
      Error: Class 'comment' not found}}

       

      {{1) qbank_previewquestion\qbank_preview_helper_test::test_get_preview_extra_elements
      Error: Class 'comment' not found}}{{}}

       

      To reproduce:
      Run the PHPUnit init:
      php admin/tool/phpunit/cli/init.php

      Run the testsuite for qbank_previewquestion:
      vendor/bin/phpunit --testsuite qbank_previewquestion_testsuite

      Same goes for comment:

      vendor/bin/phpunit --testsuite qbank_comment_testsuite

       

      The reason is it does the init call and runs the test individually right after the init. require statements for both the location will resolve the issue.

      Attachments

        Activity

          People

            safats Safat Shahin
            safats Safat Shahin
            Matt Porritt Matt Porritt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Safat Shahin, Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              19/Apr/22

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 11 minutes
                11m