Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 311 and 401] [Versions 401 and 402] [Versions 401 and 403]

Privacy provider tests.

Copyright: 2018 Mark Nelson <markn@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 2936 lines (138 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

provider_test:: (38 methods):
  test_get_metadata()
  test_export_user_preferences_no_pref()
  test_export_user_preferences()
  test_get_contexts_for_userid_no_data()
  test_get_contexts_for_userid_with_private_messages()
  test_get_contexts_for_userid_with_messages()
  test_get_contexts_for_userid_with_notification()
  test_get_contexts_for_userid_with_contact()
  test_get_contexts_for_userid_with_contact_request()
  test_get_contexts_for_userid_with_blocked_contact()
  test_export_for_context_with_contacts()
  test_export_for_context_with_contact_requests()
  test_export_for_context_with_blocked_users()
  test_export_for_context_with_private_messages()
  test_export_for_context_with_messages()
  test_export_for_context_with_notifications()
  test_delete_data_for_all_users_in_context()
  test_delete_data_for_user()
  test_get_users_in_context_no_data()
  test_get_users_in_context_with_message()
  test_get_users_in_context_with_notification()
  test_get_users_in_context_with_contact()
  test_get_users_in_context_with_contact_request()
  test_get_users_in_context_with_blocked_contact()
  test_delete_data_for_users()
  test_add_contexts_for_conversations()
  test_add_conversations_in_context()
  test_export_conversations()
  test_delete_conversations_for_all_users()
  test_delete_conversations_for_all_users_systemcontext()
  test_delete_conversations_for_all_users_usercontext()
  test_delete_conversations_for_user()
  test_delete_conversations_for_users()
  create_message()
  create_notification()
  sort_messages()
  sort_contacts()
  remove_user_self_conversation()


Class: provider_test  - X-Ref

Privacy provider tests class.

test_get_metadata()   X-Ref
Test for provider::get_metadata().


test_export_user_preferences_no_pref()   X-Ref
Test for provider::export_user_preferences().


test_export_user_preferences()   X-Ref
Test for provider::export_user_preferences().


test_get_contexts_for_userid_no_data()   X-Ref
Test for provider::get_contexts_for_userid() when there is no message or notification.


test_get_contexts_for_userid_with_private_messages()   X-Ref
Test for provider::get_contexts_for_userid() when there is a private message between users.


test_get_contexts_for_userid_with_messages()   X-Ref
Test for provider::get_contexts_for_userid() when there is several messages (private and group).


test_get_contexts_for_userid_with_notification()   X-Ref
Test for provider::get_contexts_for_userid() when there is a notification between users.


test_get_contexts_for_userid_with_contact()   X-Ref
Test for provider::get_contexts_for_userid() when a users has a contact.


test_get_contexts_for_userid_with_contact_request()   X-Ref
Test for provider::get_contexts_for_userid() when a user makes a contact request.


test_get_contexts_for_userid_with_blocked_contact()   X-Ref
Test for provider::get_contexts_for_userid() when a user is blocked.


test_export_for_context_with_contacts()   X-Ref
Test for provider::export_user_data().


test_export_for_context_with_contact_requests()   X-Ref
Test for provider::export_user_data().


test_export_for_context_with_blocked_users()   X-Ref
Test for provider::export_user_data().


test_export_for_context_with_private_messages()   X-Ref
Test for provider::export_user_data().


test_export_for_context_with_messages()   X-Ref
Test for provider::export_user_data().


test_export_for_context_with_notifications()   X-Ref
Test for provider::export_user_data().


test_delete_data_for_all_users_in_context()   X-Ref
Test for provider::delete_data_for_all_users_in_context().


test_delete_data_for_user()   X-Ref
Test for provider::delete_data_for_user().


test_get_users_in_context_no_data()   X-Ref
Test for provider::get_users_in_context() when there is no message or notification.


test_get_users_in_context_with_message()   X-Ref
Test for provider::get_users_in_context() when there is a message between users.


test_get_users_in_context_with_notification()   X-Ref
Test for provider::get_users_in_context() when there is a notification between users.


test_get_users_in_context_with_contact()   X-Ref
Test for provider::get_users_in_context() when a users has a contact.


test_get_users_in_context_with_contact_request()   X-Ref
Test for provider::get_users_in_context() when a user makes a contact request.


test_get_users_in_context_with_blocked_contact()   X-Ref
Test for provider::get_users_in_context() when a user is blocked.


test_delete_data_for_users()   X-Ref
Test for provider::delete_data_for_users().


test_add_contexts_for_conversations()   X-Ref
Test for provider::add_contexts_for_conversations().


test_add_conversations_in_context()   X-Ref
Test for provider::add_conversations_in_context().


test_export_conversations()   X-Ref
Test for provider::export_conversations().


test_delete_conversations_for_all_users()   X-Ref
Test for provider::delete_conversations_for_all_users().


test_delete_conversations_for_all_users_systemcontext()   X-Ref
Test for provider::delete_conversations_for_all_users() in the system context.


test_delete_conversations_for_all_users_usercontext()   X-Ref
Test for provider::delete_conversations_for_all_users() in the user context.


test_delete_conversations_for_user()   X-Ref
Test for provider::delete_conversations_for_user().


test_delete_conversations_for_users()   X-Ref
Test for provider::delete_conversations_for_users().


create_message(int $useridfrom, int $useridto, int $timecreated = null, bool $read = false)   X-Ref
Creates a message to be used for testing.

param: int $useridfrom The user id from
param: int $useridto The user id to
param: int $timecreated
param: bool $read Do we want to mark the message as read?
return: int The id of the message

create_notification(int $useridfrom, int $useridto, int $timecreated = null, int $timeread = null)   X-Ref
Creates a notification to be used for testing.

param: int $useridfrom The user id from
param: int $useridto The user id to
param: int|null $timecreated The time the notification was created
param: int|null $timeread The time the notification was read, null if it hasn't been.
return: int The id of the notification

sort_messages($a, $b)   X-Ref
Comparison function for sorting messages.

param: \stdClass $a
param: \stdClass $b
return: bool

sort_contacts($a, $b)   X-Ref
Comparison function for sorting contacts.

param: \stdClass $a
param: \stdClass $b
return: bool

remove_user_self_conversation(int $userid)   X-Ref
Function to unset favourite and delete all conversation data for a user's self-conversation.

param: int $userid The user id
return: void