Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 310]

Tests for the forum implementation of the Privacy Provider API.

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 2050 lines (88 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 mod/forum/tests/generator_trait.php

Defines 1 class


Class: mod_forum_privacy_provider_testcase  - X-Ref

Tests for the forum implementation of the Privacy Provider API.

setUp()   X-Ref
Test setUp.


assert_forum_data($expected, $actual)   X-Ref
Helper to assert that the forum data is correct.

param: object  $expected The expected data in the forum.
param: object  $actual The actual data in the forum.

assert_discussion_data($expected, $actual)   X-Ref
Helper to assert that the discussion data is correct.

param: object  $expected The expected data in the discussion.
param: object  $actual The actual data in the discussion.

assert_post_data($expected, $actual, $writer)   X-Ref
Helper to assert that the post data is correct.

param: object  $expected The expected data in the post.
param: object  $actual The actual data in the post.
param: \core_privacy\local\request\writer  $writer The writer used

test_user_has_never_posted()   X-Ref
Test that a user who is enrolled in a course, but who has never
posted and has no other metadata stored will not have any link to
that context.


test_user_has_never_posted_subscribed_to_forum()   X-Ref
Test that a user who is enrolled in a course, and who has never
posted and has subscribed to the forum will have relevant
information returned.


test_user_has_never_posted_subscribed_to_discussion()   X-Ref
Test that a user who is enrolled in a course, and who has never
posted and has subscribed to the discussion will have relevant
information returned.


test_user_has_posted_own_discussion()   X-Ref
Test that a user who has posted their own discussion will have all
content returned.


test_user_has_posted_reply()   X-Ref
Test that a user who has posted a reply to another users discussion will have all content returned, and
appropriate content removed.


test_user_private_reply()   X-Ref
Test private reply in a range of scenarios.


test_user_has_rated_others()   X-Ref
Test that the rating of another users content will have only the
rater's information returned.


test_user_has_been_rated()   X-Ref
Test that ratings of a users own content will all be returned.


test_user_forum_digest()   X-Ref
Test that per-user daily digest settings are included correctly.


test_user_tracking_data()   X-Ref
Test that the per-user, per-forum user tracking data is exported.


test_user_read_posts()   X-Ref
Test that the posts which a user has read are returned correctly.


test_post_attachment_inclusion()   X-Ref
Test that posts with attachments have their attachments correctly exported.


test_post_tags()   X-Ref
Test that posts which include tags have those tags exported.


test_all_users_deleted_from_context()   X-Ref
Ensure that all user data is deleted from a context.


test_delete_data_for_user()   X-Ref
Ensure that all user data is deleted for a specific context.


test_delete_data_for_users()   X-Ref
Ensure that user data for specific users is deleted from a specified context.


test_get_users_in_context_post_author()   X-Ref
Ensure that the discussion author is listed as a user in the context.


test_get_users_in_context_post_authors()   X-Ref
Ensure that all post authors are included as a user in the context.


test_get_users_in_context_post_ratings()   X-Ref
Ensure that all post raters are included as a user in the context.


test_get_users_in_context_digest_preference()   X-Ref
Ensure that all users with a digest preference are included as a user in the context.


test_get_users_in_context_with_subscription()   X-Ref
Ensure that all users with a forum subscription preference included as a user in the context.


test_get_users_in_context_with_discussion_subscription()   X-Ref
Ensure that all users with a per-discussion subscription preference included as a user in the context.


test_get_users_in_context_with_read_post_tracking()   X-Ref
Ensure that all users with read tracking are included as a user in the context.


test_get_users_in_context_with_tracking_preferences()   X-Ref
Ensure that all users with tracking preferences are included as a user in the context.


test_export_user_preferences()   X-Ref
Test exporting plugin user preferences