Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 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]

Unit tests for the privacy legacy polyfill for gradingform.

Copyright: 2018 Jake Dallimore <jrhdallimore@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 227 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 classes

gradeform_privacy_legacy_polyfill_test:: (6 methods):
  test_export_gradingform_instance_data()
  test_get_metadata()
  test_delete_gradingform_for_instances()
  test_get_gradingform_export_data()
  test_delete_gradingform_for_context()
  test_delete_gradingform_for_user()

test_legacy_polyfill_gradingform_provider:: (6 methods):
  _export_gradingform_instance_data()
  _delete_gradingform_for_instances()
  _get_metadata()
  _get_gradingform_export_data()
  _delete_gradingform_for_context()
  _delete_gradingform_for_userid()

test_gradingform_legacy_polyfill_mock_wrapper:: (1 method):
  get_return_value()


Class: gradeform_privacy_legacy_polyfill_test  - X-Ref

Unit tests for the Grading API's privacy legacy_polyfill.

test_export_gradingform_instance_data()   X-Ref
Test that the core_grading\privacy\legacy_polyfill works and that the static _export_gradingform_instance_data can be called.


test_get_metadata()   X-Ref
Test for _get_metadata shim.


test_delete_gradingform_for_instances()   X-Ref
Test the _delete_gradingform_for_instances shim.


test_get_gradingform_export_data()   X-Ref
Test the __get_gradingform_export_data shim.


test_delete_gradingform_for_context()   X-Ref
Test the _delete_gradingform_for_context shim.


test_delete_gradingform_for_user()   X-Ref
Test the _delete_gradingform_for_userid shim.


Class: test_legacy_polyfill_gradingform_provider  - X-Ref

Legacy polyfill test class for the gradingform_provider.

_export_gradingform_instance_data(\context $context, $instanceid, $subcontext)   X-Ref
Export user data relating to an instance ID.

param: \context $context Context to use with the export writer.
param: int $instanceid The instance ID to export data for.
param: array $subcontext The directory to export this data to.

_delete_gradingform_for_instances($instanceids)   X-Ref
Deletes all user data related to the provided instance IDs.

param: array  $instanceids The instance IDs to delete information from.

_get_metadata(\core_privacy\local\metadata\collection $collection)   X-Ref
Returns metadata about this plugin.

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

_get_gradingform_export_data(\context $context, $definition, int $userid)   X-Ref
This method is used to export any user data this sub-plugin has using the object to get the context and userid.

param: context $context Context owner of the data.
param: stdClass $definition Grading definition entry to export.
param: int $userid The user whose information is to be exported.
return: stdClass The data to export.

_delete_gradingform_for_context(\context $context)   X-Ref
Any call to this method should delete all user data for the context defined.

param: context $context Context owner of the data.

_delete_gradingform_for_userid(int $userid, \context $context)   X-Ref
A call to this method should delete user data (where practicle) from the userid and context.

param: int $userid The user whose information is to be deleted.
param: context $context Context owner of the data.

Class: test_gradingform_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.