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

Privacy provider tests can cause failures when extending incorrect testcase class

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_310_STABLE, MOODLE_311_STABLE
    • Hide

      1. Run each affected testsuite immediately prior to tool_dataprivacy_testsuite, aka, run:

      vendor/bin/phpunit --stop-on-failure --testsuite mod_assignment_testcase,tool_dataprivacy_testsuite && \
      vendor/bin/phpunit --stop-on-failure --testsuite quizaccess_seb_testsuite,tool_dataprivacy_testsuite && \
      vendor/bin/phpunit --stop-on-failure --testsuite mod_workshop_testsuite,tool_dataprivacy_testsuite && \
      vendor/bin/phpunit --stop-on-failure --testsuite workshopform_accumulative_testsuite,tool_dataprivacy_testsuite && \
      vendor/bin/phpunit --stop-on-failure --testsuite workshopform_comments_testsuite,tool_dataprivacy_testsuite && \
      vendor/bin/phpunit --stop-on-failure --testsuite workshopform_numerrors_testsuite,tool_dataprivacy_testsuite && \
      vendor/bin/phpunit --stop-on-failure --testsuite workshopform_rubric_testsuite,tool_dataprivacy_testsuite && \
      vendor/bin/phpunit --stop-on-failure --testsuite report_stats_testsuite,tool_dataprivacy_testsuite &&
      echo "All OK!"
      

      2. Verify that the executions end ok, with "All OK!" message at the end.

      Show
      1. Run each affected testsuite immediately prior to tool_dataprivacy_testsuite , aka, run: vendor/bin/phpunit --stop-on-failure --testsuite mod_assignment_testcase,tool_dataprivacy_testsuite && \ vendor/bin/phpunit --stop-on-failure --testsuite quizaccess_seb_testsuite,tool_dataprivacy_testsuite && \ vendor/bin/phpunit --stop-on-failure --testsuite mod_workshop_testsuite,tool_dataprivacy_testsuite && \ vendor/bin/phpunit --stop-on-failure --testsuite workshopform_accumulative_testsuite,tool_dataprivacy_testsuite && \ vendor/bin/phpunit --stop-on-failure --testsuite workshopform_comments_testsuite,tool_dataprivacy_testsuite && \ vendor/bin/phpunit --stop-on-failure --testsuite workshopform_numerrors_testsuite,tool_dataprivacy_testsuite && \ vendor/bin/phpunit --stop-on-failure --testsuite workshopform_rubric_testsuite,tool_dataprivacy_testsuite && \ vendor/bin/phpunit --stop-on-failure --testsuite report_stats_testsuite,tool_dataprivacy_testsuite && echo "All OK!" 2. Verify that the executions end ok, with " All OK! " message at the end.

      Affected testsuites all produce variations of the following when they don't extend the core_privacy\tests\provider_testcase, because they don't reset the request writer during tearDown as that class does: https://github.com/moodle/moodle/blob/3da88a7664c7cd9df39465259b4d2fadb504f3d1/privacy/classes/tests/provider_testcase.php#L42

      $ vendor/bin/phpunit --stop-on-failure --testsuite report_stats_testsuite,tool_dataprivacy_testsuite
      Moodle 4.0dev (Build: 20210507)
      Php: 7.3.28.1.16.04.1.1, mysqli: 5.7.33-0ubuntu0.16.04.1, OS: Linux 4.15.0-142-generic x86_64
      PHPUnit 9.5.2 by Sebastian Bergmann and contributors.
       
      ...............................................................  63 / 317 ( 19%)
      ............................................................... 126 / 317 ( 39%)
      ............................................................... 189 / 317 ( 59%)
      .............................................E
       
      Time: 01:08.144, Memory: 111.00 MB
       
      There was 1 error:
       
      1) tool_dataprivacy_expired_data_requests_testcase::test_data_request_expiry
      file_exception: Cannot read file. Either the file does not exist or there is a permission problem. (mock_path)
       
      /mnt/export/moodle/master/src/lib/filestorage/file_system.php:475
      /mnt/export/moodle/master/src/lib/filestorage/file_system_filedir.php:348
      /mnt/export/moodle/master/src/lib/filestorage/file_storage.php:1829
      /mnt/export/moodle/master/src/lib/filestorage/file_storage.php:1358
      /mnt/export/moodle/master/src/admin/tool/dataprivacy/classes/task/process_data_request_task.php:128
      /mnt/export/moodle/master/src/lib/phpunit/classes/advanced_testcase.php:738
      /mnt/export/moodle/master/src/admin/tool/dataprivacy/tests/expired_data_requests_test.php:81
      /mnt/export/moodle/master/src/lib/phpunit/classes/advanced_testcase.php:80
       
      ERRORS!
      Tests: 235, Assertions: 975, Errors: 1.
      

      This was reported by a partner (in WP-2665) regarding some Workplace plugins - there are various instances in Moodle too

            pholden Paul Holden
            pholden Paul Holden
            Dmitrii Metelkin Dmitrii Metelkin
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Michael Hawkins Michael Hawkins
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h

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