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.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

Unit tests for the lib/upgradelib.php library.

Copyright: 2013 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1503 lines (67 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: upgradelib_test  - X-Ref

Tests various classes and functions in upgradelib.php library.

test_upgrade_stale_php_files_present()   X-Ref
Test the {@link upgrade_stale_php_files_present() function


insert_fake_grade_item_sortorder($courseid, $sortorder)   X-Ref
Populate some fake grade items into the database with specified
sortorder and course id.

NOTE: This function doesn't make much attempt to respect the
gradebook internals, its simply used to fake some data for
testing the upgradelib function. Please don't use it for other
purposes.

param: int $courseid id of course
param: int $sortorder numeric sorting order of item
return: stdClass grade item object from the database.

test_upgrade_extra_credit_weightoverride()   X-Ref
No description

test_upgrade_calculated_grade_items_freeze()   X-Ref
Test the upgrade function for flagging courses with calculated grade item problems.


test_upgrade_update_category_grademax_regrade_final_grades()   X-Ref
Test the upgrade function for final grade after setting grade max for category and grade item.


test_upgrade_calculated_grade_items_regrade()   X-Ref
No description

test_upgrade_course_letter_boundary()   X-Ref
Test that the upgrade script correctly flags courses to be frozen due to letter boundary problems.


test_upgrade_letter_boundary_needs_freeze()   X-Ref
Test upgrade_letter_boundary_needs_freeze function.


assign_bad_letter_boundary($contextid)   X-Ref
Assigns letter boundaries with comparison problems.

param: int $contextid Context ID.

assign_good_letter_boundary($contextid)   X-Ref
Assigns letter boundaries with no comparison problems.

param: int $contextid Context ID.

test_check_libcurl_version()   X-Ref
Test libcurl custom check api.


create_testthemes()   X-Ref
Create a collection of test themes to test determining parent themes.

return: Url to the path containing the test themes

serialized_strings_dataprovider()   X-Ref
Data provider of serialized string.

return: array

test_upgrade_fix_serialized_objects($initialstring, $expectededited, $expectedresult)   X-Ref
Test that objects in serialized strings will be changed over to stdClass.

param: string $initialstring The initial serialized setting.
param: bool $expectededited If the string is expected to be edited.
param: string $expectedresult The expected serialized setting to be returned.

encoded_strings_dataprovider()   X-Ref
Data provider for base64_encoded block instance config data.


test_upgrade_delete_orphaned_file_records()   X-Ref
Check that orphaned files are deleted.


test_upgrade_core_licenses()   X-Ref
Test the functionality of {@link upgrade_core_licenses} function.


run_upgrade_step_query()   X-Ref
Execute same problematic query from upgrade step.

return: bool

test_upgrade_calendar_events_status()   X-Ref
Test the functionality of upgrade_calendar_events_status() function.


test_upgrade_calendar_events_get_teacherid()   X-Ref
Test the functionality of upgrade_calendar_events_get_teacherid() function.


test_upgrade_calendar_standard_events_fix()   X-Ref
Test the functionality of upgrade_calendar_standard_events_fix() function.


test_upgrade_calendar_subscription_events_fix()   X-Ref
Test the functionality of upgrade_calendar_subscription_events_fix() function.


test_upgrade_calendar_action_events_fix()   X-Ref
Test the functionality of upgrade_calendar_action_events_fix() function.


test_upgrade_calendar_user_override_events_fix()   X-Ref
Test the user override part of upgrade_calendar_override_events_fix() function.


test_upgrade_calendar_group_override_events_fix()   X-Ref
Test the group override part of upgrade_calendar_override_events_fix() function.


test_admin_dir_usage_not_set()   X-Ref
Test the admin_dir_usage check with no admin setting specified.


test_admin_dir_usage_is_default()   X-Ref
Test the admin_dir_usage check with the default admin setting specified.


test_admin_dir_usage_non_standard()   X-Ref
Test the admin_dir_usage check with a custom admin setting specified.


test_check_xmlrpc_webservice_is_not_set()   X-Ref
Test the check_xmlrpc_usage check when the XML-RPC web service method is not set.

return: void

test_check_xmlrpc_webservice_is_set()   X-Ref
Test the check_xmlrpc_usage check when the XML-RPC web service method is set.

return: void

test_check_mod_assignment_is_used()   X-Ref
Test the check_mod_assignment check if mod_assignment is still used.

return: void

usermenu_items_dataprovider()   X-Ref
Data provider of usermenu items.

return: array

test_upgrade_add_item_to_usermenu(string $initialmenu, string $newmenuitem, string $expectedmenu)   X-Ref
Test the functionality of the {@link upgrade_add_item_to_usermenu()} function.


test_upgrade_fix_file_timestamps()   X-Ref
Test that file timestamps are corrected for copied files.