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] [Versions 39 and 310]

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: 1529 lines (71 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_rename_prediction_actions_useful_incorrectly_flagged()   X-Ref
Test that the previous records are updated according to the reworded actions.

return: null

test_upgrade_convert_hub_config_site_param_names()   X-Ref
Test the functionality of the {@link upgrade_convert_hub_config_site_param_names()} function.


test_upgrade_analytics_fix_contextids_defaults()   X-Ref
Test the functionality of the {@link upgrade_analytics_fix_contextids_defaults} function.


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.