Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 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 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Provides the {@link tool_policy_api_testcase} class.

Copyright: 2018 David Mudrák <david@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 815 lines (40 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: tool_policy_api_testcase  - 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()}.