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.

Class: api_test  - X-Ref

Unit tests for the {@link \tool_policy\api} class.

test_policy_document_life_cycle()   X-Ref
Test the common operations with a policy document and its versions.


test_policy_sortorder()   X-Ref
Test changing the sort order of the policy documents.


test_list_policies_audience()   X-Ref
Test that list of policies can be filtered by audience


test_can_user_view_policy_version()   X-Ref
Test behaviour of the {@link api::can_user_view_policy_version()} method.


test_can_accept_policies()   X-Ref
Test behaviour of the {@link api::can_accept_policies()} method.


test_can_decline_policies()   X-Ref
Test behaviour of the {@link api::can_decline_policies()} method.


test_can_revoke_policies()   X-Ref
Test behaviour of the {@link api::can_revoke_policies()} method.


test_fix_revision_values()   X-Ref
Test {@link api::fix_revision_values()} behaviour.


test_accept_policies()   X-Ref
Test that accepting policy updates 'policyagreed'


test_reset_policyagreed()   X-Ref
Test that activating a new policy resets everybody's policyagreed flag in the database.


test_get_user_minors()   X-Ref
Test behaviour of the {@link api::get_user_minors()} method.


test_create_acceptances_user_created()   X-Ref
Test behaviour of the {@link api::create_acceptances_user_created()} method.


test_login_with_handler_without_policies()   X-Ref
Test that user can login if sitepolicyhandler is set but there are no policies.


test_is_user_version_accepted()   X-Ref
Test the three-state logic of the value returned by {@link api::is_user_version_accepted()}.


test_get_agreement_optional()   X-Ref
Test the functionality of {@link api::get_agreement_optional()}.