Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 39 and 311]

Unit tests for the Privacy API's legacy_polyfill.

Copyright: 2018 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 283 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 6 classes

legacy_polyfill_test:: (7 methods):
  test_null_provider()
  test_metadata_provider()
  test_user_preference_provider()
  test_get_contexts_for_userid()
  test_export_user_data()
  test_delete_data_for_all_users_in_context()
  test_delete_data_for_user()

test_legacy_polyfill_null_provider:: (1 method):
  _get_reason()

test_legacy_polyfill_metadata_provider:: (1 method):
  _get_metadata()

test_legacy_polyfill_user_preference_provider:: (1 method):
  _export_user_preferences()

test_legacy_polyfill_request_provider:: (4 methods):
  _get_contexts_for_userid()
  _export_user_data()
  _delete_data_for_all_users_in_context()
  _delete_data_for_user()

test_legacy_polyfill_mock_wrapper:: (1 method):
  get_return_value()


Class: legacy_polyfill_test  - X-Ref

Unit tests for the Privacy API's legacy_polyfill.

test_null_provider()   X-Ref
Test that the null_provider polyfill works and that the static _get_reason can be
successfully called.


test_metadata_provider()   X-Ref
Test that the metdata\provider polyfill works and that the static _get_metadata can be
successfully called.


test_user_preference_provider()   X-Ref
Test that the local\request\user_preference_provider polyfill works and that the static
_export_user_preferences can be successfully called.


test_get_contexts_for_userid()   X-Ref
Test that the local\request\core_user_preference_provider polyfill works and that the static
_get_contexts_for_userid can be successfully called.


test_export_user_data()   X-Ref
Test that the local\request\core_user_preference_provider polyfill works and that the static
_export_user_data can be successfully called.


test_delete_data_for_all_users_in_context()   X-Ref
Test that the local\request\core_user_preference_provider polyfill works and that the static
_delete_data_for_all_users_in_context can be successfully called.


test_delete_data_for_user()   X-Ref
Test that the local\request\core_user_preference_provider polyfill works and that the static
_delete_data_for_user can be successfully called.


Class: test_legacy_polyfill_null_provider  - X-Ref

Legacy polyfill test for the null provider.

_get_reason()   X-Ref
Test for get_reason


Class: test_legacy_polyfill_metadata_provider  - X-Ref

Legacy polyfill test for the metadata provider.

_get_metadata(collection $collection)   X-Ref
Test for get_metadata.

param: collection     $collection The initialised collection to add items to.
return: collection     A listing of user data stored through this system.

Class: test_legacy_polyfill_user_preference_provider  - X-Ref

Legacy polyfill test for the metadata provider.

_export_user_preferences($userid)   X-Ref
Export all user preferences for the plugin.

param: int         $userid The userid of the user whose data is to be exported.

Class: test_legacy_polyfill_request_provider  - X-Ref

Legacy polyfill test for the request provider.

_get_contexts_for_userid($userid)   X-Ref
Test for get_contexts_for_userid.

param: int         $userid     The user to search.
return: contextlist   $contextlist  The contextlist containing the list of contexts used in this plugin.

_export_user_data(approved_contextlist $contextlist)   X-Ref
Test for export_user_data.

param: approved_contextlist    $contextlist    The approved contexts to export information for.

_delete_data_for_all_users_in_context(\context $context)   X-Ref
Delete all use data which matches the specified deletion criteria.

param: context         $context   The specific context to delete data for.

_delete_data_for_user(approved_contextlist $contextlist)   X-Ref
Delete all user data for the specified user, in the specified contexts.

param: approved_contextlist    $contextlist    The approved contexts and user information to delete information for.

Class: test_legacy_polyfill_mock_wrapper  - X-Ref

get_return_value()   X-Ref
Get the return value for the specified item.