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.

Unit tests for the privacy legacy polyfill for mod_assign.

Copyright: 2018 Adrian Greeve
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 230 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

feedback_legacy_polyfill_test:: (6 methods):
  create_instance()
  test_get_context_for_userid_within_feedback()
  test_get_student_user_ids()
  test_export_feedback_user_data()
  test_delete_feedback_for_context()
  test_delete_feedback_for_grade()

test_legacy_polyfill_feedback_provider:: (5 methods):
  _get_context_for_userid_within_feedback()
  _get_student_user_ids()
  _export_feedback_user_data()
  _delete_feedback_for_context()
  _delete_feedback_for_grade()

test_assignfeedback_legacy_polyfill_mock_wrapper:: (1 method):
  get_return_value()


Class: feedback_legacy_polyfill_test  - X-Ref

Unit tests for the assignment feedback subplugins API's privacy legacy_polyfill.

create_instance($params = array()   X-Ref
Convenience function to create an instance of an assignment.

param: array $params Array of parameters to pass to the generator
return: assign The assign class.

test_get_context_for_userid_within_feedback()   X-Ref
Test the get_context_for_userid_within_feedback shim.


test_get_student_user_ids()   X-Ref
Test the get_student_user_ids shim.


test_export_feedback_user_data()   X-Ref
Test the export_feedback_user_data shim.


test_delete_feedback_for_context()   X-Ref
Test the delete_feedback_for_context shim.


test_delete_feedback_for_grade()   X-Ref
Test the delete feedback for grade shim.


Class: test_legacy_polyfill_feedback_provider  - X-Ref

Legacy polyfill test class for the assignfeedback_provider.

_get_context_for_userid_within_feedback(int $userid,\core_privacy\local\request\contextlist $contextlist)   X-Ref
Retrieves the contextids associated with the provided userid for this subplugin.
NOTE if your subplugin must have an entry in the assign_grade table to work, then this
method can be empty.

param: int $userid The user ID to get context IDs for.
param: contextlist $contextlist Use add_from_sql with this object to add your context IDs.

_get_student_user_ids(\mod_assign\privacy\useridlist $useridlist)   X-Ref
Returns student user ids related to the provided teacher ID. If an entry must be present in the assign_grade table for
your plugin to work then there is no need to fill in this method. If you filled in get_context_for_userid_within_feedback()
then you probably have to fill this in as well.

param: useridlist $useridlist A list of user IDs of students graded by this user.

_export_feedback_user_data(\mod_assign\privacy\assign_plugin_request_data $exportdata)   X-Ref
Export feedback data with the available grade and userid information provided.
assign_plugin_request_data contains:
- context
- grade object
- current path (subcontext)
- user object

param: assign_plugin_request_data $exportdata Contains data to help export the user information.

_delete_feedback_for_context(\mod_assign\privacy\assign_plugin_request_data $requestdata)   X-Ref
Any call to this method should delete all user data for the context defined in the deletion_criteria.
assign_plugin_request_data contains:
- context
- assign object

param: assign_plugin_request_data $requestdata Data useful for deleting user data from this sub-plugin.

_delete_feedback_for_grade(\mod_assign\privacy\assign_plugin_request_data $requestdata)   X-Ref
Calling this function should delete all user data associated with this grade.
assign_plugin_request_data contains:
- context
- grade object
- user object
- assign object

param: assign_plugin_request_data $requestdata Data useful for deleting user data.

Class: test_assignfeedback_legacy_polyfill_mock_wrapper  - X-Ref

Called inside the polyfill methods in the test polyfill provider, allowing us to ensure these are called with correct params.

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