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.

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: 231 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

submission_legacy_polyfill_test:: (6 methods):
  create_instance()
  test_get_context_for_userid_within_submission()
  test_get_student_user_ids()
  test_export_submission_user_data()
  test_delete_submission_for_context()
  test_delete_submission_for_userid()

test_legacy_polyfill_submission_provider:: (5 methods):
  _get_context_for_userid_within_submission()
  _get_student_user_ids()
  _export_submission_user_data()
  _delete_submission_for_context()
  _delete_submission_for_userid()

test_assignsubmission_legacy_polyfill_mock_wrapper:: (1 method):
  get_return_value()


Class: submission_legacy_polyfill_test  - X-Ref

Unit tests for the assignment submission 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_submission()   X-Ref
Test the get_context_for_userid_within_submission shim.


test_get_student_user_ids()   X-Ref
Test the get_student_user_ids shim.


test_export_submission_user_data()   X-Ref
Test the export_submission_user_data shim.


test_delete_submission_for_context()   X-Ref
Test the delete_submission_for_context shim.


test_delete_submission_for_userid()   X-Ref
Test the delete submission for grade shim.


Class: test_legacy_polyfill_submission_provider  - X-Ref

Legacy polyfill test class for the assignsubmission_provider.

_get_context_for_userid_within_submission(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 it is possible that a student ID will not be returned by
the sql query in \mod_assign\privacy\provider::find_grader_info() Then you need to provide some sql to retrive those
student IDs. This is highly likely if you had to fill in get_context_for_userid_within_submission above.

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

_export_submission_user_data(\mod_assign\privacy\assign_plugin_request_data $exportdata)   X-Ref
This method is used to export any user data this sub-plugin has using the assign_plugin_request_data object to get the
context and userid.
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_submission_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_submission_for_userid(\mod_assign\privacy\assign_plugin_request_data $requestdata)   X-Ref
A call to this method should delete user data (where practicle) from the userid and context.
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_assignsubmission_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.