From c370c0cc5e5532b0e048019685fc8a071637b28c Mon Sep 17 00:00:00 2001
From: Andrew Nicols
Date: Sat, 13 Apr 2024 14:40:07 +0800
Subject: [PATCH] MDL-81521 core: Update all possibly data providers to be
static
Note: Some data providers could not be automatically be converted to
being static. These will be handled in a separate issue.
---
admin/presets/tests/generator_test.php | 2 +-
admin/presets/tests/helper_test.php | 8 +-
...inpresets_admin_setting_bloglevel_test.php | 2 +-
...presets_admin_setting_sitesettext_test.php | 2 +-
.../setting/adminpresets_setting_test.php | 4 +-
admin/presets/tests/manager_test.php | 4 +-
.../external/set_block_protection_test.php | 2 +-
.../tests/external/set_plugin_order_test.php | 4 +-
.../tests/external/set_plugin_state_test.php | 2 +-
.../datasource/task_logs_test.php | 2 +-
.../tests/local/action/base_test.php | 2 +-
.../tests/local/action/export_test.php | 2 +-
.../tests/local/action/import_test.php | 2 +-
.../tool/behat/tests/behat_form_text_test.php | 8 +-
admin/tool/brickfield/tests/tool_test.php | 10 +-
.../tests/local/mlang/langstring_test.php | 2 +-
.../tests/local/mlang/phpparser_test.php | 2 +-
admin/tool/dataprivacy/tests/api_test.php | 16 +-
.../dataprivacy/tests/data_request_test.php | 6 +-
.../tests/expired_contexts_test.php | 6 +-
.../tests/external/external_test.php | 4 +-
.../tests/filtered_userlist_test.php | 2 +-
.../httpsreplace/tests/httpsreplace_test.php | 48 ++---
.../tool/langimport/tests/controller_test.php | 2 +-
.../log/store/standard/tests/store_test.php | 2 +-
.../tool/mfa/factor/sms/tests/factor_test.php | 4 +-
.../mfa/factor/token/tests/factor_test.php | 2 +-
.../tests/admin_setting_managemfa_test.php | 2 +-
admin/tool/mfa/tests/manager_test.php | 2 +-
admin/tool/moodlenet/tests/lib_test.php | 2 +-
.../tests/local/import_handler_info_test.php | 2 +-
.../tests/local/remote_resource_test.php | 8 +-
admin/tool/moodlenet/tests/local/url_test.php | 2 +-
.../recyclebin/tests/category_bin_test.php | 2 +-
.../tool/recyclebin/tests/course_bin_test.php | 2 +-
admin/tool/uploadcourse/tests/course_test.php | 2 +-
.../tests/field_value_validators_test.php | 2 +-
analytics/tests/calculation_info_test.php | 5 +-
analytics/tests/indicator_test.php | 7 +-
analytics/tests/manager_test.php | 101 ++++++-----
analytics/tests/prediction_actions_test.php | 2 +-
analytics/tests/prediction_test.php | 24 ++-
auth/ldap/tests/auth_ldap_test.php | 2 +-
auth/lti/tests/auth_test.php | 149 ++++++++--------
.../completion/tests/condition_test.php | 4 +-
.../tests/backup_xml_transformer_test.php | 2 +-
.../restore_gradebook_structure_step_test.php | 7 +-
.../util/dbops/tests/restore_dbops_test.php | 7 +-
...estore_structure_parser_processor_test.php | 2 +-
badges/tests/badgeslib_test.php | 16 +-
.../output/manage_badge_action_bar_test.php | 2 +-
.../reportbuilder/datasource/users_test.php | 2 +-
.../tests/privacy/provider_test.php | 2 +-
blocks/rss_client/tests/cron_test.php | 2 +-
.../timeline/tests/privacy/provider_test.php | 2 +-
.../reportbuilder/datasource/blogs_test.php | 2 +-
cache/stores/redis/tests/compressor_test.php | 6 +-
calendar/tests/action_event_test.php | 4 +-
calendar/tests/action_test.php | 4 +-
.../tests/calendar_event_exporter_test.php | 8 +-
calendar/tests/container_test.php | 12 +-
calendar/tests/event_description_test.php | 4 +-
calendar/tests/event_factory_test.php | 4 +-
calendar/tests/event_test.php | 4 +-
calendar/tests/event_times_test.php | 4 +-
calendar/tests/externallib_test.php | 4 +-
calendar/tests/lib_test.php | 2 +-
calendar/tests/std_proxy_test.php | 4 +-
.../reportbuilder/datasource/cohorts_test.php | 2 +-
.../datasource/comments_test.php | 2 +-
.../tests/activity_custom_completion_test.php | 4 +-
completion/tests/bulk_update_test.php | 4 +-
.../tests/cm_completion_details_test.php | 12 +-
completion/tests/generator_test.php | 2 +-
.../h5p/tests/content_h5p_test.php | 2 +-
contentbank/tests/content_test.php | 2 +-
contentbank/tests/contentbank_test.php | 8 +-
contentbank/tests/contenttype_test.php | 4 +-
.../tests/external/rename_content_test.php | 2 +-
course/format/tests/base_test.php | 10 +-
.../format/tests/external/get_state_test.php | 2 +-
.../tests/external/update_course_test.php | 2 +-
.../tests/output/local/state/cm_test.php | 2 +-
.../tests/output/local/state/section_test.php | 2 +-
.../tests/output/local/state/state_test.php | 2 +-
course/format/tests/stateactions_test.php | 63 +++----
course/format/tests/stateupdates_test.php | 22 +--
.../tests/courseformat/stateactions_test.php | 2 +-
course/tests/category_test.php | 2 +-
course/tests/courselib_test.php | 36 ++--
course/tests/externallib_test.php | 2 +-
.../reportbuilder/datasource/courses_test.php | 2 +-
course/tests/targets_test.php | 6 +-
customfield/field/date/tests/plugin_test.php | 2 +-
enrol/ldap/tests/ldap_test.php | 4 +-
enrol/lti/tests/helper_test.php | 2 +-
.../ltiadvantage/entity/ags_info_test.php | 2 +-
.../entity/application_registration_test.php | 6 +-
.../ltiadvantage/entity/context_test.php | 2 +-
.../ltiadvantage/entity/deployment_test.php | 2 +-
.../entity/migration_claim_test.php | 60 +++++--
.../ltiadvantage/entity/nrps_info_test.php | 2 +-
.../entity/resource_link_test.php | 4 +-
.../ltiadvantage/lti_advantage_testcase.php | 8 +-
...plication_registration_repository_test.php | 2 +-
.../service/tool_launch_service_test.php | 48 ++---
.../ltiadvantage/task/sync_members_test.php | 167 +++++++++---------
.../utility/message_helper_test.php | 2 +-
enrol/manual/tests/lib_test.php | 4 +-
enrol/tests/course_enrolment_manager_test.php | 2 +-
enrol/tests/enrollib_test.php | 14 +-
.../unoconv/tests/converter_test.php | 2 +-
filter/tex/tests/lib_test.php | 2 +-
grade/import/csv/tests/load_data_test.php | 2 +-
grade/report/overview/tests/lib_test.php | 2 +-
grade/tests/component_gradeitems_test.php | 12 +-
grade/tests/export_test.php | 2 +-
grade/tests/external/get_feedback_test.php | 4 +-
.../external/get_gradable_users_test.php | 2 +-
.../point/external/store_test.php | 2 +-
.../scale/external/store_test.php | 2 +-
grade/tests/lib_test.php | 12 +-
.../tests/output/general_action_bar_test.php | 2 +-
.../reportbuilder/datasource/groups_test.php | 2 +-
h5p/tests/api_test.php | 14 +-
h5p/tests/editor_ajax_test.php | 2 +-
h5p/tests/editor_framework_test.php | 4 +-
h5p/tests/file_storage_test.php | 2 +-
h5p/tests/framework_test.php | 6 +-
h5p/tests/generator_test.php | 12 +-
h5p/tests/helper_test.php | 4 +-
h5p/tests/local/library/handler_test.php | 2 +-
iplookup/tests/geoip_test.php | 27 ++-
lib/ddl/tests/ddl_test.php | 4 +-
lib/dml/tests/dml_read_slave_test.php | 2 +-
lib/dml/tests/dml_table_test.php | 4 +-
lib/dml/tests/dml_test.php | 4 +-
.../sqlsrv_native_moodle_database_test.php | 7 +-
lib/external/tests/external_api_test.php | 2 +-
lib/external/tests/external_value_test.php | 2 +-
lib/filestorage/tests/file_storage_test.php | 2 +-
.../tests/file_system_filedir_test.php | 2 +-
lib/filestorage/tests/file_system_test.php | 4 +-
lib/filestorage/tests/mbz_packer_test.php | 2 +-
lib/form/tests/duration_test.php | 4 +-
lib/form/tests/filetypes_util_test.php | 32 +---
lib/form/tests/privacy/provider_test.php | 7 +-
lib/mlbackend/python/tests/processor_test.php | 13 +-
lib/phpunit/classes/advanced_testcase.php | 37 ++--
lib/phpunit/tests/phpunit_dataset_test.php | 14 +-
lib/phpunit/tests/util_test.php | 2 +-
lib/table/tests/local/filter/filter_test.php | 6 +-
.../local/filter/integer_filter_test.php | 2 +-
.../filter/numeric_comparison_filter_test.php | 2 +-
.../tests/local/filter/string_filter_test.php | 2 +-
lib/table/tests/tablelib_test.php | 4 +-
lib/tests/accesslib_has_capability_test.php | 4 +-
lib/tests/accesslib_test.php | 10 +-
lib/tests/adminlib_test.php | 4 +-
lib/tests/behat_lib_test.php | 2 +-
lib/tests/client_test.php | 2 +-
lib/tests/completionlib_test.php | 8 +-
lib/tests/configonlylib_test.php | 2 +-
.../core_renderer_template_exploit_test.php | 4 +-
lib/tests/curl_security_helper_test.php | 8 +-
lib/tests/datalib_test.php | 4 +-
lib/tests/date_test.php | 2 +-
lib/tests/encryption_test.php | 2 +-
.../external/moodlenet_send_activity_test.php | 2 +-
.../external/moodlenet_send_course_test.php | 2 +-
.../icon_system/load_fontawesome_map_test.php | 2 +-
.../record_userfeedback_action_test.php | 2 +-
lib/tests/filestorage_zip_archive_test.php | 2 +-
lib/tests/gradelib_test.php | 2 +-
lib/tests/graphlib_test.php | 2 +-
lib/tests/htmlpurifier_test.php | 2 +-
lib/tests/ip_utils_test.php | 18 +-
lib/tests/ldaplib_test.php | 2 +-
lib/tests/modinfolib_test.php | 2 +-
lib/tests/moodle_page_test.php | 4 +-
lib/tests/moodlelib_test.php | 57 +++---
lib/tests/moodlenet/activity_sender_test.php | 2 +-
.../moodlenet/course_partial_sender_test.php | 2 +-
lib/tests/moodlenet/course_sender_test.php | 2 +-
lib/tests/myprofilelib_test.php | 2 +-
lib/tests/navigation/output/primary_test.php | 4 +-
lib/tests/navigation/views/primary_test.php | 4 +-
lib/tests/navigation/views/secondary_test.php | 20 +--
lib/tests/navigationlib_test.php | 6 +-
.../auth_server_config_reader_test.php | 2 +-
lib/tests/oauth2_test.php | 6 +-
lib/tests/output/activity_header_test.php | 4 +-
lib/tests/output/icon_system_test.php | 14 +-
lib/tests/output/language_menu_test.php | 2 +-
.../mustache_helper_collection_test.php | 4 +-
.../output/mustache_template_finder_test.php | 4 +-
.../mustache_template_source_loader_test.php | 16 +-
.../output/participants_action_bar_test.php | 2 +-
lib/tests/outputcomponents_test.php | 2 +-
lib/tests/outputrequirementslib_test.php | 6 +-
lib/tests/plugininfo/base_test.php | 8 +-
lib/tests/plugininfo/block_test.php | 2 +-
lib/tests/plugininfo/editor_test.php | 4 +-
lib/tests/plugininfo/media_test.php | 4 +-
lib/tests/plugininfo/repository_test.php | 2 +-
lib/tests/questionlib_test.php | 4 +-
lib/tests/rtlcss_test.php | 20 +--
lib/tests/scss_test.php | 4 +-
lib/tests/session/manager_test.php | 2 +-
lib/tests/sessionlib_test.php | 2 +-
lib/tests/setuplib_test.php | 2 +-
lib/tests/statslib_test.php | 4 +-
lib/tests/string_manager_standard_test.php | 8 +-
lib/tests/task/database_logger_test.php | 2 +-
.../task/file_temp_cleanup_task_test.php | 61 +++----
.../task/hide_ended_courses_task_test.php | 1 -
lib/tests/task/scheduled_task_test.php | 2 +-
.../task/show_started_courses_task_test.php | 2 +-
lib/tests/text_test.php | 4 +-
lib/tests/upgrade_util_test.php | 6 +-
lib/tests/upgradelib_test.php | 4 +-
lib/tests/user_menu_test.php | 2 +-
lib/tests/useragent_test.php | 2 +-
lib/tests/weblib_format_text_test.php | 4 +-
lib/tests/weblib_test.php | 12 +-
lib/xapi/tests/external/delete_state_test.php | 4 +-
.../tests/external/delete_states_test.php | 4 +-
lib/xapi/tests/external/get_state_test.php | 4 +-
lib/xapi/tests/external/get_states_test.php | 10 +-
lib/xapi/tests/external/post_state_test.php | 4 +-
.../tests/external/post_statement_test.php | 8 +-
lib/xapi/tests/iri_test.php | 4 +-
.../local/statement/item_activity_test.php | 4 +-
.../tests/local/statement/item_agent_test.php | 4 +-
.../local/statement/item_attachment_test.php | 2 +-
.../local/statement/item_definition_test.php | 2 +-
.../tests/local/statement/item_group_test.php | 2 +-
.../local/statement/item_object_test.php | 2 +-
.../local/statement/item_result_test.php | 2 +-
.../tests/local/statement/item_verb_test.php | 4 +-
lib/xapi/tests/local/statement_test.php | 6 +-
lib/xapi/tests/state_store_test.php | 10 +-
login/tests/login_lib_test.php | 2 +-
media/player/videojs/tests/player_test.php | 2 +-
message/tests/externallib_test.php | 4 +-
message/tests/helper_test.php | 2 +-
.../onlinetext/tests/locallib_test.php | 2 +-
mod/assign/tests/custom_completion_test.php | 4 +-
mod/assign/tests/dates_test.php | 2 +-
mod/assign/tests/downloader_test.php | 14 +-
mod/assign/tests/externallib_test.php | 2 +-
.../tests/backup_restore_test.php | 2 +-
.../tests/completion/completion_test.php | 2 +-
.../tests/external/get_recordings_test.php | 2 +-
mod/bigbluebuttonbn/tests/instance_test.php | 16 +-
.../recordings/recording_data_test.php | 2 +-
.../tests/local/extension_test.php | 2 +-
mod/bigbluebuttonbn/tests/meeting_test.php | 4 +-
.../output/recording_row_playback_test.php | 2 +-
mod/bigbluebuttonbn/tests/recording_test.php | 4 +-
mod/chat/tests/format_message_test.php | 2 +-
mod/choice/tests/custom_completion_test.php | 4 +-
mod/choice/tests/dates_test.php | 2 +-
mod/data/tests/custom_completion_test.php | 4 +-
mod/data/tests/dates_test.php | 2 +-
mod/data/tests/entries_exporter_test.php | 6 +-
mod/data/tests/entries_import_test.php | 2 +-
mod/data/tests/entries_importer_test.php | 2 +-
mod/data/tests/event/events_test.php | 2 +-
.../external/get_mapping_information_test.php | 2 +-
mod/data/tests/generator_test.php | 2 +-
mod/data/tests/lib_test.php | 6 +-
mod/data/tests/manager_test.php | 4 +-
mod/data/tests/preset_importer_test.php | 15 +-
mod/data/tests/preset_test.php | 4 +-
mod/data/tests/template_test.php | 4 +-
mod/feedback/tests/custom_completion_test.php | 4 +-
mod/feedback/tests/dates_test.php | 2 +-
.../tests/form/create_template_form_test.php | 4 +-
.../tests/form/use_template_form_test.php | 2 +-
mod/folder/tests/lib_test.php | 2 +-
.../tests/backup_forum_activity_task_test.php | 2 +-
mod/forum/tests/custom_completion_test.php | 4 +-
mod/forum/tests/dates_test.php | 2 +-
mod/forum/tests/entities_discussion_test.php | 2 +-
mod/forum/tests/exporters_post_test.php | 2 +-
.../tests/grade/forum_gradeitem_test.php | 2 +-
mod/forum/tests/grade/gradeitems_test.php | 2 +-
mod/forum/tests/h5p/canedit_test.php | 2 +-
mod/forum/tests/lib_test.php | 10 +-
mod/forum/tests/mail_test.php | 2 +-
mod/forum/tests/output_email_test.php | 2 +-
mod/forum/tests/subscriptions_test.php | 8 +-
mod/glossary/tests/custom_completion_test.php | 4 +-
.../tests/event/report_viewed_test.php | 2 +-
.../tests/external/get_attempts_test.php | 4 +-
...et_h5pactivity_access_information_test.php | 2 +-
.../tests/external/get_results_test.php | 6 +-
.../tests/external/get_user_attempts_test.php | 4 +-
mod/h5pactivity/tests/local/attempt_test.php | 6 +-
mod/h5pactivity/tests/local/grader_test.php | 4 +-
mod/h5pactivity/tests/local/manager_test.php | 20 +--
mod/h5pactivity/tests/restore_test.php | 2 +-
mod/label/tests/lib_test.php | 2 +-
mod/lesson/tests/dates_test.php | 2 +-
mod/lesson/tests/locallib_test.php | 2 +-
mod/lesson/tests/numeric_helper_test.php | 4 +-
.../local/ltiopenid/jwks_helper_test.php | 2 +-
mod/lti/tests/locallib_test.php | 6 +-
mod/lti/tests/servicelib_test.php | 2 +-
.../seb/tests/access_manager_test.php | 6 +-
.../accessrule/seb/tests/config_key_test.php | 2 +-
.../external/validate_quiz_access_test.php | 2 +-
.../seb/tests/property_list_test.php | 6 +-
.../seb/tests/quiz_settings_test.php | 4 +-
mod/quiz/accessrule/seb/tests/rule_test.php | 4 +-
.../seb/tests/settings_provider_test.php | 2 +-
.../accessrule/timelimit/tests/rule_test.php | 2 +-
.../report/overview/tests/report_test.php | 4 +-
mod/quiz/tests/dates_test.php | 2 +-
mod/quiz/tests/lib_test.php | 2 +-
mod/quiz/tests/locallib_test.php | 2 +-
mod/scorm/tests/custom_completion_test.php | 4 +-
mod/scorm/tests/dates_test.php | 2 +-
mod/scorm/tests/event/events_test.php | 4 +-
mod/survey/tests/custom_completion_test.php | 4 +-
mod/wiki/tests/wikiparser_test.php | 2 +-
mod/workshop/tests/dates_test.php | 2 +-
mod/workshop/tests/lib_test.php | 4 +-
.../reportbuilder/datasource/notes_test.php | 2 +-
payment/tests/helper_test.php | 4 +-
privacy/tests/collection_test.php | 2 +-
privacy/tests/contextlist_base_test.php | 2 +-
privacy/tests/contextlist_test.php | 2 +-
privacy/tests/manager_test.php | 4 +-
privacy/tests/moodle_content_writer_test.php | 14 +-
privacy/tests/privacy/provider_test.php | 40 ++---
privacy/tests/request_transform_test.php | 2 +-
privacy/tests/types_database_table_test.php | 4 +-
.../tests/types_external_location_test.php | 4 +-
privacy/tests/types_plugintype_link_test.php | 4 +-
privacy/tests/types_subsystem_link_test.php | 4 +-
privacy/tests/types_user_preference_test.php | 4 +-
privacy/tests/userlist_base_test.php | 2 +-
.../bank/statistics/tests/helper_test.php | 60 +++----
.../tests/external/submit_tags_test.php | 4 +-
question/engine/tests/datalib_test.php | 2 +-
.../tests/question_display_options_test.php | 4 +-
.../engine/tests/question_engine_test.php | 10 +-
.../tests/questionattempt_with_steps_test.php | 2 +-
.../format/gift/tests/giftformat_test.php | 4 +-
.../calculated_question_summary_test.php | 4 +-
question/tests/externallib_test.php | 4 +-
.../statistics_bulk_loader_test.php | 64 +++----
.../tests/random_question_loader_test.php | 4 +-
.../tests/privacy/provider_test.php | 2 +-
.../ddmarker/tests/privacy/provider_test.php | 2 +-
.../ddwtos/tests/privacy/provider_test.php | 2 +-
.../type/essay/tests/form/edit_form_test.php | 2 +-
.../essay/tests/privacy/provider_test.php | 2 +-
question/type/essay/tests/question_test.php | 10 +-
.../gapselect/tests/privacy/provider_test.php | 2 +-
.../match/tests/privacy/provider_test.php | 2 +-
.../tests/privacy/provider_test.php | 2 +-
.../multichoice/tests/question_type_test.php | 2 +-
.../numerical/tests/answerprocessor_test.php | 12 +-
.../tests/privacy/provider_test.php | 2 +-
rating/tests/rating_test.php | 2 +-
.../external/system_report_exporter_test.php | 2 +-
.../tests/local/entities/user_test.php | 2 +-
.../tests/local/filters/autocomplete_test.php | 2 +-
.../local/filters/boolean_select_test.php | 2 +-
.../tests/local/filters/category_test.php | 2 +-
.../tests/local/filters/select_test.php | 2 +-
.../tests/local/filters/text_test.php | 4 +-
.../tests/local/filters/user_test.php | 2 +-
.../tests/local/helpers/schedule_test.php | 2 +-
.../helpers/user_filter_manager_test.php | 4 +-
.../tests/local/report/action_test.php | 2 +-
reportbuilder/tests/manager_test.php | 2 +-
.../tests/task/send_schedule_test.php | 2 +-
.../contentbank/tests/search/search_test.php | 2 +-
repository/dropbox/tests/api_test.php | 6 +-
.../tests/googledocs_search_content_test.php | 42 ++---
repository/googledocs/tests/helper_test.php | 15 +-
.../browser/googledocs_drive_content_test.php | 45 +++--
.../browser/googledocs_root_content_test.php | 44 +++--
.../googledocs_shared_drives_content_test.php | 30 ++--
.../tests/local/node/file_node_test.php | 26 ++-
.../tests/local/node/folder_node_test.php | 17 +-
.../tests/repository_googledocs_testcase.php | 46 +++--
repository/nextcloud/tests/lib_test.php | 2 +-
search/engine/solr/tests/engine_test.php | 5 +-
search/tests/document_test.php | 2 +-
search/tests/manager_test.php | 6 +-
sms/gateway/aws/tests/helper_test.php | 2 +-
.../reportbuilder/datasource/tags_test.php | 2 +-
theme/boost/tests/boostnavbar_test.php | 6 +-
theme/boost/tests/privacy/provider_test.php | 2 +-
.../field/text/tests/field_class_test.php | 2 +-
user/tests/externallib_test.php | 6 +-
user/tests/fields_test.php | 2 +-
user/tests/profilelib_test.php | 2 +-
user/tests/table/participants_search_test.php | 16 +-
user/tests/userlib_test.php | 2 +-
webservice/rest/tests/server_test.php | 6 +-
webservice/tests/lib_test.php | 2 +-
407 files changed, 1449 insertions(+), 1430 deletions(-)
diff --git a/admin/presets/tests/generator_test.php b/admin/presets/tests/generator_test.php
index 52ef904e996..a8bef76ceed 100644
--- a/admin/presets/tests/generator_test.php
+++ b/admin/presets/tests/generator_test.php
@@ -180,7 +180,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
- public function create_preset_provider(): array {
+ public static function create_preset_provider(): array {
return [
'Default values' => [
],
diff --git a/admin/presets/tests/helper_test.php b/admin/presets/tests/helper_test.php
index a913993f7b3..70031e17338 100644
--- a/admin/presets/tests/helper_test.php
+++ b/admin/presets/tests/helper_test.php
@@ -84,7 +84,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
- public function create_preset_provider(): array {
+ public static function create_preset_provider(): array {
return [
'Default values' => [
],
@@ -177,7 +177,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
- public function add_item_provider(): array {
+ public static function add_item_provider(): array {
return [
'Setting without plugin' => [
'name' => 'settingname',
@@ -239,7 +239,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
- public function add_plugin_provider(): array {
+ public static function add_plugin_provider(): array {
return [
'Plugin: enabled (using int)' => [
'type' => 'plugintype',
@@ -321,7 +321,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
- public function change_default_preset_provider(): array {
+ public static function change_default_preset_provider(): array {
return [
'Starter preset' => [
'preset' => 'starter',
diff --git a/admin/presets/tests/local/setting/adminpresets_admin_setting_bloglevel_test.php b/admin/presets/tests/local/setting/adminpresets_admin_setting_bloglevel_test.php
index d59108abbc5..4f6a59a5a65 100644
--- a/admin/presets/tests/local/setting/adminpresets_admin_setting_bloglevel_test.php
+++ b/admin/presets/tests/local/setting/adminpresets_admin_setting_bloglevel_test.php
@@ -72,7 +72,7 @@ class adminpresets_admin_setting_bloglevel_test extends \advanced_testcase {
*
* @return array
*/
- public function save_value_provider(): array {
+ public static function save_value_provider(): array {
return [
'Save the bloglevel and set blog_menu block visibility to true' => [
'setttingvalue' => BLOG_USER_LEVEL,
diff --git a/admin/presets/tests/local/setting/adminpresets_admin_setting_sitesettext_test.php b/admin/presets/tests/local/setting/adminpresets_admin_setting_sitesettext_test.php
index 3ae332154fa..de2f2159800 100644
--- a/admin/presets/tests/local/setting/adminpresets_admin_setting_sitesettext_test.php
+++ b/admin/presets/tests/local/setting/adminpresets_admin_setting_sitesettext_test.php
@@ -66,7 +66,7 @@ class adminpresets_admin_setting_sitesettext_test extends \advanced_testcase {
*
* @return array
*/
- public function save_value_provider(): array {
+ public static function save_value_provider(): array {
return [
'Fullname: different value' => [
'settingname' => 'fullname',
diff --git a/admin/presets/tests/local/setting/adminpresets_setting_test.php b/admin/presets/tests/local/setting/adminpresets_setting_test.php
index 3cd81ed5d54..e57dbb9ed0e 100644
--- a/admin/presets/tests/local/setting/adminpresets_setting_test.php
+++ b/admin/presets/tests/local/setting/adminpresets_setting_test.php
@@ -77,7 +77,7 @@ class adminpresets_setting_test extends \advanced_testcase {
*
* @return array
*/
- public function save_value_provider(): array {
+ public static function save_value_provider(): array {
return [
'Core setting with the same value is not saved' => [
'category' => 'optionalsubsystems',
@@ -167,7 +167,7 @@ class adminpresets_setting_test extends \advanced_testcase {
*
* @return array
*/
- public function save_attributes_values_provider(): array {
+ public static function save_attributes_values_provider(): array {
return [
'Plugin setting with the same value is not saved' => [
'category' => 'modsettinglesson',
diff --git a/admin/presets/tests/manager_test.php b/admin/presets/tests/manager_test.php
index 7b295699847..9ce31973c1e 100644
--- a/admin/presets/tests/manager_test.php
+++ b/admin/presets/tests/manager_test.php
@@ -368,7 +368,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function export_preset_provider(): array {
+ public static function export_preset_provider(): array {
return [
'Export settings and plugins, excluding sensible' => [
'includesensible' => false,
@@ -531,7 +531,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function import_preset_provider(): array {
+ public static function import_preset_provider(): array {
return [
'Import settings from an empty file' => [
'filecontents' => '',
diff --git a/admin/tests/external/set_block_protection_test.php b/admin/tests/external/set_block_protection_test.php
index 60cbd4071fb..82f9ece14e4 100644
--- a/admin/tests/external/set_block_protection_test.php
+++ b/admin/tests/external/set_block_protection_test.php
@@ -85,7 +85,7 @@ class set_block_protection_test extends \externallib_advanced_testcase {
*
* @return array
*/
- public function execute_provider(): array {
+ public static function execute_provider(): array {
return [
[
'block_login',
diff --git a/admin/tests/external/set_plugin_order_test.php b/admin/tests/external/set_plugin_order_test.php
index 8673e3c4ae1..33482cb4e11 100644
--- a/admin/tests/external/set_plugin_order_test.php
+++ b/admin/tests/external/set_plugin_order_test.php
@@ -72,7 +72,7 @@ class set_plugin_order_test extends \externallib_advanced_testcase {
*
* @return array
*/
- public function execute_editor_provider(): array {
+ public static function execute_editor_provider(): array {
$pluginmanager = \core_plugin_manager::instance();
$allplugins = array_keys($pluginmanager->get_plugins_of_type('editor'));
@@ -142,7 +142,7 @@ class set_plugin_order_test extends \externallib_advanced_testcase {
$this->assertIsArray(set_plugin_order::execute($plugin, 1));
}
- public function execute_non_orderable_provider(): array {
+ public static function execute_non_orderable_provider(): array {
return [
// Activities do not support ordering.
['mod_assign'],
diff --git a/admin/tests/external/set_plugin_state_test.php b/admin/tests/external/set_plugin_state_test.php
index febea139898..9bdff10ba47 100644
--- a/admin/tests/external/set_plugin_state_test.php
+++ b/admin/tests/external/set_plugin_state_test.php
@@ -66,7 +66,7 @@ class set_plugin_state_test extends \externallib_advanced_testcase {
*
* @return array
*/
- public function execute_standard_provider(): array {
+ public static function execute_standard_provider(): array {
$generatetestsfor = function (string $plugin): array {
return [
[
diff --git a/admin/tests/reportbuilder/datasource/task_logs_test.php b/admin/tests/reportbuilder/datasource/task_logs_test.php
index 4acd7ba845b..511cd332836 100644
--- a/admin/tests/reportbuilder/datasource/task_logs_test.php
+++ b/admin/tests/reportbuilder/datasource/task_logs_test.php
@@ -110,7 +110,7 @@ class task_logs_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
- public function datasource_filters_provider(): array {
+ public static function datasource_filters_provider(): array {
return [
'Filter name' => ['task_log:name', [
'task_log:name_values' => [send_schedules::class],
diff --git a/admin/tool/admin_presets/tests/local/action/base_test.php b/admin/tool/admin_presets/tests/local/action/base_test.php
index 2cf069cc361..de2b8354057 100644
--- a/admin/tool/admin_presets/tests/local/action/base_test.php
+++ b/admin/tool/admin_presets/tests/local/action/base_test.php
@@ -70,7 +70,7 @@ class base_test extends \advanced_testcase {
*
* @return array
*/
- public function log_provider(): array {
+ public static function log_provider(): array {
return [
// Action = base.
'action=base and mode = show' => [
diff --git a/admin/tool/admin_presets/tests/local/action/export_test.php b/admin/tool/admin_presets/tests/local/action/export_test.php
index 4e858f400b9..0a7660b7939 100644
--- a/admin/tool/admin_presets/tests/local/action/export_test.php
+++ b/admin/tool/admin_presets/tests/local/action/export_test.php
@@ -156,7 +156,7 @@ class export_test extends \advanced_testcase {
*
* @return array
*/
- public function export_execute_provider(): array {
+ public static function export_execute_provider(): array {
return [
'Export settings and plugins, excluding sensible' => [
'includesensible' => false,
diff --git a/admin/tool/admin_presets/tests/local/action/import_test.php b/admin/tool/admin_presets/tests/local/action/import_test.php
index d36cca2430e..a6ceb08fb6b 100644
--- a/admin/tool/admin_presets/tests/local/action/import_test.php
+++ b/admin/tool/admin_presets/tests/local/action/import_test.php
@@ -190,7 +190,7 @@ class import_test extends \advanced_testcase {
*
* @return array
*/
- public function import_execute_provider(): array {
+ public static function import_execute_provider(): array {
$fixturesfolder = __DIR__ . '/../../../../../presets/tests/fixtures/';
return [
diff --git a/admin/tool/behat/tests/behat_form_text_test.php b/admin/tool/behat/tests/behat_form_text_test.php
index a57906959ae..105ab13f5c3 100644
--- a/admin/tool/behat/tests/behat_form_text_test.php
+++ b/admin/tool/behat/tests/behat_form_text_test.php
@@ -53,7 +53,7 @@ class behat_form_text_test extends \basic_testcase {
*
* @return array of value and expectation pairs to be tested.
*/
- public function provider_test_set_get_value() {
+ public static function provider_test_set_get_value(): array {
return [
'null' => [null, null],
'int' => [3, 3],
@@ -68,7 +68,7 @@ class behat_form_text_test extends \basic_testcase {
*
* @param mixed $value value to be set.
* @param mixed $expectation value to be checked.
- * @dataProvider provider_test_set_get_value()
+ * @dataProvider provider_test_set_get_value
*/
public function test_set_get_value($value, $expectation): void {
$session = $this->createMock(Session::class);
@@ -85,7 +85,7 @@ class behat_form_text_test extends \basic_testcase {
*
* @return array of decsep, value, match and result pairs to be tested.
*/
- public function provider_test_matches() {
+ public static function provider_test_matches(): array {
return [
'lazy true' => ['.', 'hello', 'hello', true],
'lazy false' => ['.', 'hello', 'bye', false],
@@ -113,7 +113,7 @@ class behat_form_text_test extends \basic_testcase {
* @param mixed $value value to be set.
* @param mixed $match value to be matched.
* @param bool $result expected return status of the function.
- * @dataProvider provider_test_matches()
+ * @dataProvider provider_test_matches
*/
public function test_matches($decsep, $value, $match, $result): void {
global $CFG;
diff --git a/admin/tool/brickfield/tests/tool_test.php b/admin/tool/brickfield/tests/tool_test.php
index ed3e64ca033..75823f00b83 100644
--- a/admin/tool/brickfield/tests/tool_test.php
+++ b/admin/tool/brickfield/tests/tool_test.php
@@ -30,7 +30,7 @@ use tool_brickfield\local\tool\tool;
class tool_test extends \advanced_testcase {
/** @var string base 64 image */
- protected $base64img = <<';
return [
'Image tag alone (base64)' => [
- $this->base64img,
+ self::$base64img,
true,
],
'Image tag alone (link)' => [
@@ -130,7 +130,7 @@ EOF;
false,
],
'Image tag in string (base64)' => [
- "This is my image {$this->base64img}.",
+ "This is my image " . self::$base64img,
true,
],
'Image tag in string (link)' => [
@@ -162,7 +162,7 @@ EOF;
}
public function test_truncate_base64(): void {
- $truncated = tool::truncate_base64($this->base64img);
+ $truncated = tool::truncate_base64(self::$base64img);
$this->assertStringContainsString('
[
'No PHP code', [], false
diff --git a/admin/tool/dataprivacy/tests/api_test.php b/admin/tool/dataprivacy/tests/api_test.php
index e2c2dce5678..0c0195fc519 100644
--- a/admin/tool/dataprivacy/tests/api_test.php
+++ b/admin/tool/dataprivacy/tests/api_test.php
@@ -633,7 +633,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function data_request_creation_provider() {
+ public static function data_request_creation_provider(): array {
return [
'Export request by user, automatic approval off' => [
false, api::DATAREQUEST_TYPE_EXPORT, 'automaticdataexportapproval', false, 0,
@@ -815,7 +815,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function get_data_requests_provider() {
+ public static function get_data_requests_provider(): array {
$completeonly = [api::DATAREQUEST_STATUS_COMPLETE, api::DATAREQUEST_STATUS_DOWNLOAD_READY, api::DATAREQUEST_STATUS_DELETED];
$completeandcancelled = array_merge($completeonly, [api::DATAREQUEST_STATUS_CANCELLED]);
@@ -1000,7 +1000,7 @@ class api_test extends \advanced_testcase {
/**
* Data provider for test_has_ongoing_request.
*/
- public function status_provider() {
+ public static function status_provider(): array {
return [
[api::DATAREQUEST_STATUS_AWAITING_APPROVAL, true],
[api::DATAREQUEST_STATUS_APPROVED, true],
@@ -1090,7 +1090,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function notify_dpo_provider() {
+ public static function notify_dpo_provider(): array {
return [
[false, api::DATAREQUEST_TYPE_EXPORT, 'requesttypeexport', 'Export my user data'],
[false, api::DATAREQUEST_TYPE_DELETE, 'requesttypedelete', 'Delete my user data'],
@@ -1442,7 +1442,7 @@ class api_test extends \advanced_testcase {
/**
* Data provider for invalid contextlevel fetchers.
*/
- public function invalid_effective_contextlevel_provider() {
+ public static function invalid_effective_contextlevel_provider(): array {
return [
[CONTEXT_COURSECAT],
[CONTEXT_COURSE],
@@ -2002,7 +2002,7 @@ class api_test extends \advanced_testcase {
/**
* Data provider for \tool_dataprivacy_api_testcase::test_set_context_defaults
*/
- public function set_context_defaults_provider() {
+ public static function set_context_defaults_provider(): array {
$contextlevels = [
[CONTEXT_COURSECAT],
[CONTEXT_COURSE],
@@ -2477,7 +2477,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function queue_data_request_task_provider() {
+ public static function queue_data_request_task_provider(): array {
return [
'With user ID provided' => [true],
'Without user ID provided' => [false],
@@ -2514,7 +2514,7 @@ class api_test extends \advanced_testcase {
/**
* Data provider for test_is_automatic_request_approval_on().
*/
- public function automatic_request_approval_setting_provider() {
+ public static function automatic_request_approval_setting_provider(): array {
return [
'Data export, not set' => [
'automaticdataexportapproval', api::DATAREQUEST_TYPE_EXPORT, null, false
diff --git a/admin/tool/dataprivacy/tests/data_request_test.php b/admin/tool/dataprivacy/tests/data_request_test.php
index ddd1127ba18..25ad30fbf09 100644
--- a/admin/tool/dataprivacy/tests/data_request_test.php
+++ b/admin/tool/dataprivacy/tests/data_request_test.php
@@ -35,7 +35,7 @@ class data_request_test extends data_privacy_testcase {
*
* @return array
*/
- public function status_state_provider(): array {
+ public static function status_state_provider(): array {
return [
[
'state' => api::DATAREQUEST_STATUS_PENDING,
@@ -138,9 +138,9 @@ class data_request_test extends data_privacy_testcase {
*
* @return array
*/
- public function non_resettable_provider(): array {
+ public static function non_resettable_provider(): array {
$states = [];
- foreach ($this->status_state_provider() as $thisstatus) {
+ foreach (self::status_state_provider() as $thisstatus) {
if (!$thisstatus['resettable']) {
$states[] = $thisstatus;
}
diff --git a/admin/tool/dataprivacy/tests/expired_contexts_test.php b/admin/tool/dataprivacy/tests/expired_contexts_test.php
index a1922eece6b..162bf185910 100644
--- a/admin/tool/dataprivacy/tests/expired_contexts_test.php
+++ b/admin/tool/dataprivacy/tests/expired_contexts_test.php
@@ -1950,7 +1950,7 @@ class expired_contexts_test extends \advanced_testcase {
*
* @return array
*/
- public function can_process_deletion_provider(): array {
+ public static function can_process_deletion_provider(): array {
return [
'Pending' => [
expired_context::STATUS_EXPIRED,
@@ -1988,7 +1988,7 @@ class expired_contexts_test extends \advanced_testcase {
*
* @return array
*/
- public function is_complete_provider(): array {
+ public static function is_complete_provider(): array {
return [
'Pending' => [
expired_context::STATUS_EXPIRED,
@@ -2023,7 +2023,7 @@ class expired_contexts_test extends \advanced_testcase {
*
* @return array
*/
- public function is_fully_expired_provider(): array {
+ public static function is_fully_expired_provider(): array {
return [
'Fully expired' => [
[
diff --git a/admin/tool/dataprivacy/tests/external/external_test.php b/admin/tool/dataprivacy/tests/external/external_test.php
index c8be8c63ee5..20614042802 100644
--- a/admin/tool/dataprivacy/tests/external/external_test.php
+++ b/admin/tool/dataprivacy/tests/external/external_test.php
@@ -580,7 +580,7 @@ class external_test extends externallib_advanced_testcase {
/**
* Data provider for \tool_dataprivacy_external_testcase::test_XX_options().
*/
- public function get_options_provider() {
+ public static function get_options_provider(): array {
return [
[false, false],
[false, true],
@@ -705,7 +705,7 @@ class external_test extends externallib_advanced_testcase {
/**
* Data provider for \tool_dataprivacy_external_testcase::get_activity_options().
*/
- public function get_activity_options_provider() {
+ public static function get_activity_options_provider(): array {
return [
[false, false, true],
[false, true, true],
diff --git a/admin/tool/dataprivacy/tests/filtered_userlist_test.php b/admin/tool/dataprivacy/tests/filtered_userlist_test.php
index f54114cd9d9..67602fbdf7d 100644
--- a/admin/tool/dataprivacy/tests/filtered_userlist_test.php
+++ b/admin/tool/dataprivacy/tests/filtered_userlist_test.php
@@ -57,7 +57,7 @@ class filtered_userlist_test extends \advanced_testcase {
*
* @return array
*/
- public function apply_expired_contexts_filters_provider(): array {
+ public static function apply_expired_contexts_filters_provider(): array {
return [
// Entire list should be preserved.
'No overrides' => [
diff --git a/admin/tool/httpsreplace/tests/httpsreplace_test.php b/admin/tool/httpsreplace/tests/httpsreplace_test.php
index bd4b0e4e72c..387aa8ab896 100644
--- a/admin/tool/httpsreplace/tests/httpsreplace_test.php
+++ b/admin/tool/httpsreplace/tests/httpsreplace_test.php
@@ -38,20 +38,20 @@ class httpsreplace_test extends \advanced_testcase {
/**
* Data provider for test_upgrade_http_links
*/
- public function upgrade_http_links_provider() {
+ public static function upgrade_http_links_provider(): array {
global $CFG;
// Get the http url, since the default test wwwroot is https.
$wwwroothttp = preg_replace('/^https:/', 'http:', $CFG->wwwroot);
return [
"Test image from another site should be replaced" => [
- "content" => '
',
+ "content" => '
',
"outputregex" => '/UPDATE/',
- "expectedcontent" => '
',
+ "expectedcontent" => '
',
],
"Test object from another site should be replaced" => [
- "content" => '
',
"outputregex" => '/UPDATE/',
- "expectedcontent" => '
'
',
],
"Broken URL should not be changed" => [
- "content" => '
',
+ "content" => '
',
"outputregex" => '/^$/',
- "expectedcontent" => '
',
+ "expectedcontent" => '
',
],
"Link URL should not be changed" => [
- "content" => '' .
- $this->getExternalTestFileUrl('/test.png', false) . '',
+ "content" => '' .
+ self::getExternalTestFileUrl('/test.png', false) . '',
"outputregex" => '/^$/',
- "expectedcontent" => '' .
- $this->getExternalTestFileUrl('/test.png', false) . '',
+ "expectedcontent" => '' .
+ self::getExternalTestFileUrl('/test.png', false) . '',
],
"Test image from another site should be replaced but link should not" => [
- "content" => '
',
+ "content" => '
',
"outputregex" => '/UPDATE/',
- "expectedcontent" => '
',
+ "expectedcontent" => '
',
],
];
}
@@ -127,8 +127,8 @@ class httpsreplace_test extends \advanced_testcase {
* @param string $path Path to be rewritten
* @return string
*/
- protected function get_converted_http_link($path) {
- return preg_replace('/^http:/', 'https:', $this->getExternalTestFileUrl($path, false));
+ protected static function get_converted_http_link($path) {
+ return preg_replace('/^http:/', 'https:', self::getExternalTestFileUrl($path, false));
}
/**
@@ -160,15 +160,15 @@ class httpsreplace_test extends \advanced_testcase {
/**
* Data provider for test_http_link_stats
*/
- public function http_link_stats_provider() {
+ public static function http_link_stats_provider(): array {
global $CFG;
// Get the http url, since the default test wwwroot is https.
$wwwrootdomain = 'www.example.com';
$wwwroothttp = preg_replace('/^https:/', 'http:', $CFG->wwwroot);
- $testdomain = $this->get_converted_http_link('');
+ $testdomain = self::get_converted_http_link('');
return [
"Test image from an available site so shouldn't be reported" => [
- "content" => '
',
+ "content" => '
',
"domain" => $testdomain,
"expectedcount" => 0,
],
diff --git a/admin/tool/langimport/tests/controller_test.php b/admin/tool/langimport/tests/controller_test.php
index 03b0ebb4700..008dd470dca 100644
--- a/admin/tool/langimport/tests/controller_test.php
+++ b/admin/tool/langimport/tests/controller_test.php
@@ -48,7 +48,7 @@ class controller_test extends \advanced_testcase {
*
* @return array
*/
- public function uninstall_lang_invalid_provider(): array {
+ public static function uninstall_lang_invalid_provider(): array {
return [
'Empty string' => [''],
'Meaningless empty string' => [' '],
diff --git a/admin/tool/log/store/standard/tests/store_test.php b/admin/tool/log/store/standard/tests/store_test.php
index 74c5c8deba6..36cd4471c3e 100644
--- a/admin/tool/log/store/standard/tests/store_test.php
+++ b/admin/tool/log/store/standard/tests/store_test.php
@@ -389,7 +389,7 @@ class store_test extends \advanced_testcase {
*
* @return array Array of parameters
*/
- public function decode_other_provider(): array {
+ public static function decode_other_provider(): array {
return [
[['info' => 'd2819896', 'logurl' => 'discuss.php?d=2819896']],
[null],
diff --git a/admin/tool/mfa/factor/sms/tests/factor_test.php b/admin/tool/mfa/factor/sms/tests/factor_test.php
index 49e3e9a3313..4d98eb90e1e 100644
--- a/admin/tool/mfa/factor/sms/tests/factor_test.php
+++ b/admin/tool/mfa/factor/sms/tests/factor_test.php
@@ -32,7 +32,7 @@ class factor_test extends \advanced_testcase {
*
* @return array of different country codes and phone numbers.
*/
- public function format_number_provider(): array {
+ public static function format_number_provider(): array {
return [
'Phone number with local format' => [
@@ -88,7 +88,7 @@ class factor_test extends \advanced_testcase {
*
* @return array with different phone numebr tests
*/
- public function is_valid_phonenumber_provider(): array {
+ public static function is_valid_phonenumber_provider(): array {
return [
['+919367788755', true],
['8989829304', false],
diff --git a/admin/tool/mfa/factor/token/tests/factor_test.php b/admin/tool/mfa/factor/token/tests/factor_test.php
index d04bb5ccbb4..89200adb3ff 100644
--- a/admin/tool/mfa/factor/token/tests/factor_test.php
+++ b/admin/tool/mfa/factor/token/tests/factor_test.php
@@ -276,7 +276,7 @@ class factor_test extends \advanced_testcase {
* Increments by 30 minutes to cover half hour and hour cases.
* Starting timestamp: 2022-01-15 07:30:00 Australia/Melbourne time.
*/
- public function timestamp_provider() {
+ public static function timestamp_provider(): array {
$starttimestamp = 1642192200;
foreach (range(0, 23) as $i) {
$timestamps[] = [$starttimestamp + ($i * HOURSECS)];
diff --git a/admin/tool/mfa/tests/admin_setting_managemfa_test.php b/admin/tool/mfa/tests/admin_setting_managemfa_test.php
index fcfd43a2cf0..1a37b8384ab 100644
--- a/admin/tool/mfa/tests/admin_setting_managemfa_test.php
+++ b/admin/tool/mfa/tests/admin_setting_managemfa_test.php
@@ -51,7 +51,7 @@ class admin_setting_managemfa_test extends \advanced_testcase {
*
* @return array
*/
- public function get_factor_combinations_provider() {
+ public static function get_factor_combinations_provider(): array {
$provider = [];
$factors = [];
diff --git a/admin/tool/mfa/tests/manager_test.php b/admin/tool/mfa/tests/manager_test.php
index 8eace2573b2..64d7fcb97d7 100644
--- a/admin/tool/mfa/tests/manager_test.php
+++ b/admin/tool/mfa/tests/manager_test.php
@@ -157,7 +157,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public static function should_redirect_urls_provider() {
+ public static function should_redirect_urls_provider(): array {
$badurl1 = new \moodle_url('/');
$badparam1 = $badurl1->out();
$badurl2 = new \moodle_url('admin/tool/mfa/auth.php');
diff --git a/admin/tool/moodlenet/tests/lib_test.php b/admin/tool/moodlenet/tests/lib_test.php
index 85dd5818714..cd02734fb39 100644
--- a/admin/tool/moodlenet/tests/lib_test.php
+++ b/admin/tool/moodlenet/tests/lib_test.php
@@ -52,7 +52,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function get_endpoints_provider() {
+ public static function get_endpoints_provider(): array {
global $CFG;
return [
[
diff --git a/admin/tool/moodlenet/tests/local/import_handler_info_test.php b/admin/tool/moodlenet/tests/local/import_handler_info_test.php
index df6d9b59f9e..7f1cdbb2ac5 100644
--- a/admin/tool/moodlenet/tests/local/import_handler_info_test.php
+++ b/admin/tool/moodlenet/tests/local/import_handler_info_test.php
@@ -59,7 +59,7 @@ class import_handler_info_test extends \advanced_testcase {
*
* @return array the data for creation of the info object.
*/
- public function handler_info_data_provider() {
+ public static function handler_info_data_provider(): array {
return [
'All data present' => ['label', 'Add a label to the course', false],
'Empty module name' => ['', 'Add a file resource to the course', true],
diff --git a/admin/tool/moodlenet/tests/local/remote_resource_test.php b/admin/tool/moodlenet/tests/local/remote_resource_test.php
index 53b30bfe0f8..219feed6fec 100644
--- a/admin/tool/moodlenet/tests/local/remote_resource_test.php
+++ b/admin/tool/moodlenet/tests/local/remote_resource_test.php
@@ -53,10 +53,10 @@ class remote_resource_test extends \advanced_testcase {
*
* @return array
*/
- public function remote_resource_data_provider() {
+ public static function remote_resource_data_provider(): array {
return [
'With filename and extension' => [
- $this->getExternalTestFileUrl('/test.html'),
+ self::getExternalTestFileUrl('/test.html'),
(object) [
'name' => 'Test html file',
'description' => 'Full description of the html file'
@@ -78,8 +78,8 @@ class remote_resource_test extends \advanced_testcase {
* Test confirming the network based operations of a remote_resource.
*/
public function test_network_features(): void {
- $url = $this->getExternalTestFileUrl('/test.html');
- $nonexistenturl = $this->getExternalTestFileUrl('/test.htmlzz');
+ $url = self::getExternalTestFileUrl('/test.html');
+ $nonexistenturl = self::getExternalTestFileUrl('/test.htmlzz');
$remoteres = new remote_resource(
new \curl(),
diff --git a/admin/tool/moodlenet/tests/local/url_test.php b/admin/tool/moodlenet/tests/local/url_test.php
index a948732c79f..ade2f0c6e82 100644
--- a/admin/tool/moodlenet/tests/local/url_test.php
+++ b/admin/tool/moodlenet/tests/local/url_test.php
@@ -55,7 +55,7 @@ class url_test extends \advanced_testcase {
*
* @return array
*/
- public function url_provider() {
+ public static function url_provider(): array {
return [
'No path' => [
'url' => 'https://example.moodle.net',
diff --git a/admin/tool/recyclebin/tests/category_bin_test.php b/admin/tool/recyclebin/tests/category_bin_test.php
index 7876b7ac4b2..162d2531a77 100644
--- a/admin/tool/recyclebin/tests/category_bin_test.php
+++ b/admin/tool/recyclebin/tests/category_bin_test.php
@@ -176,7 +176,7 @@ class category_bin_test extends \advanced_testcase {
* Used to verify that recycle bin is immune to various settings. Provides plugin, name, value for
* direct usage with set_config()
*/
- public function recycle_bin_settings_provider() {
+ public static function recycle_bin_settings_provider(): array {
return [
'backup/backup_auto_storage moodle' => [[
(object)['plugin' => 'backup', 'name' => 'backup_auto_storage', 'value' => 0],
diff --git a/admin/tool/recyclebin/tests/course_bin_test.php b/admin/tool/recyclebin/tests/course_bin_test.php
index d7ed2ec733e..602434a5751 100644
--- a/admin/tool/recyclebin/tests/course_bin_test.php
+++ b/admin/tool/recyclebin/tests/course_bin_test.php
@@ -176,7 +176,7 @@ class course_bin_test extends \advanced_testcase {
* Used to verify that recycle bin is immune to various settings. Provides plugin, name, value for
* direct usage with set_config()
*/
- public function recycle_bin_settings_provider() {
+ public static function recycle_bin_settings_provider(): array {
return [
'backup/backup_auto_storage moodle' => [[
(object)['plugin' => 'backup', 'name' => 'backup_auto_storage', 'value' => 0],
diff --git a/admin/tool/uploadcourse/tests/course_test.php b/admin/tool/uploadcourse/tests/course_test.php
index 5a40d5ed67f..3da6389681f 100644
--- a/admin/tool/uploadcourse/tests/course_test.php
+++ b/admin/tool/uploadcourse/tests/course_test.php
@@ -1276,7 +1276,7 @@ class course_test extends \advanced_testcase {
*
* @return array
*/
- public function enrolment_uploaddata_error_provider(): array {
+ public static function enrolment_uploaddata_error_provider(): array {
return [
['errorcannotcreateorupdateenrolment', [
'shortname' => 'C1',
diff --git a/admin/tool/uploaduser/tests/field_value_validators_test.php b/admin/tool/uploaduser/tests/field_value_validators_test.php
index 5d4a2f8fb7a..995926d97c7 100644
--- a/admin/tool/uploaduser/tests/field_value_validators_test.php
+++ b/admin/tool/uploaduser/tests/field_value_validators_test.php
@@ -30,7 +30,7 @@ class field_value_validators_test extends \advanced_testcase {
/**
* Data provider for \field_value_validators_testcase::test_validate_theme().
*/
- public function themes_provider() {
+ public static function themes_provider(): array {
return [
'User themes disabled' => [
false, 'boost', 'warning', get_string('userthemesnotallowed', 'tool_uploaduser')
diff --git a/analytics/tests/calculation_info_test.php b/analytics/tests/calculation_info_test.php
index 6a837ee5c19..2976bcebf01 100644
--- a/analytics/tests/calculation_info_test.php
+++ b/analytics/tests/calculation_info_test.php
@@ -23,8 +23,7 @@ namespace core_analytics;
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class calculation_info_test extends \advanced_testcase {
-
+final class calculation_info_test extends \advanced_testcase {
/**
* test_calculation_info description
*
@@ -88,7 +87,7 @@ class calculation_info_test extends \advanced_testcase {
*
* @return mixed[]
*/
- public function provider_test_calculation_info_add_pull() {
+ public static function provider_test_calculation_info_add_pull(): array {
return [
'mixed-types' => ['asd', true, [123, 123, 123], (object)['asd' => 'fgfg']],
];
diff --git a/analytics/tests/indicator_test.php b/analytics/tests/indicator_test.php
index 49c02edcba4..f724498db51 100644
--- a/analytics/tests/indicator_test.php
+++ b/analytics/tests/indicator_test.php
@@ -29,8 +29,7 @@ require_once(__DIR__ . '/fixtures/test_indicator_min.php');
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class indicator_test extends \advanced_testcase {
-
+final class indicator_test extends \advanced_testcase {
/**
* test_validate_calculated_value
*
@@ -50,7 +49,7 @@ class indicator_test extends \advanced_testcase {
*
* @return array
*/
- public function validate_calculated_value() {
+ public static function validate_calculated_value(): array {
return [
'max' => ['test_indicator_max', [1]],
'min' => ['test_indicator_min', [-1]],
@@ -83,7 +82,7 @@ class indicator_test extends \advanced_testcase {
*
* @return array
*/
- public function validate_calculated_value_exceptions() {
+ public static function validate_calculated_value_exceptions(): array {
return [
'max' => ['test_indicator_max', 2],
'min' => ['test_indicator_min', -2],
diff --git a/analytics/tests/manager_test.php b/analytics/tests/manager_test.php
index 802ddf52e24..589f6021e5a 100644
--- a/analytics/tests/manager_test.php
+++ b/analytics/tests/manager_test.php
@@ -31,8 +31,7 @@ require_once(__DIR__ . '/fixtures/test_target_course_level_shortname.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \core_analytics\manager
*/
-class manager_test extends \advanced_testcase {
-
+final class manager_test extends \advanced_testcase {
/**
* test_deleted_context
*/
@@ -44,7 +43,7 @@ class manager_test extends \advanced_testcase {
set_config('enabled_stores', 'logstore_standard', 'tool_log');
$target = \core_analytics\manager::get_target('test_target_course_level_shortname');
- $indicators = array('test_indicator_max', 'test_indicator_min', 'test_indicator_fullname');
+ $indicators = ['test_indicator_max', 'test_indicator_min', 'test_indicator_fullname'];
foreach ($indicators as $key => $indicator) {
$indicators[$key] = \core_analytics\manager::get_indicator($indicator);
}
@@ -52,10 +51,10 @@ class manager_test extends \advanced_testcase {
$model = \core_analytics\model::create($target, $indicators);
$modelobj = $model->get_model_obj();
- $coursepredict1 = $this->getDataGenerator()->create_course(array('visible' => 0));
- $coursepredict2 = $this->getDataGenerator()->create_course(array('visible' => 0));
- $coursetrain1 = $this->getDataGenerator()->create_course(array('visible' => 1));
- $coursetrain2 = $this->getDataGenerator()->create_course(array('visible' => 1));
+ $coursepredict1 = $this->getDataGenerator()->create_course(['visible' => 0]);
+ $coursepredict2 = $this->getDataGenerator()->create_course(['visible' => 0]);
+ $coursetrain1 = $this->getDataGenerator()->create_course(['visible' => 1]);
+ $coursetrain2 = $this->getDataGenerator()->create_course(['visible' => 1]);
$model->enable('\core\analytics\time_splitting\no_splitting');
@@ -65,25 +64,33 @@ class manager_test extends \advanced_testcase {
// Generate a prediction action to confirm that it is deleted when there is an important update.
$predictions = $DB->get_records('analytics_predictions');
$prediction = reset($predictions);
- $prediction = new \core_analytics\prediction($prediction, array('whatever' => 'not used'));
+ $prediction = new \core_analytics\prediction($prediction, ['whatever' => 'not used']);
$prediction->action_executed(\core_analytics\prediction::ACTION_USEFUL, $model->get_target());
$predictioncontextid = $prediction->get_prediction_data()->contextid;
- $npredictions = $DB->count_records('analytics_predictions', array('contextid' => $predictioncontextid));
- $npredictionactions = $DB->count_records('analytics_prediction_actions',
- array('predictionid' => $prediction->get_prediction_data()->id));
- $nindicatorcalc = $DB->count_records('analytics_indicator_calc', array('contextid' => $predictioncontextid));
+ $npredictions = $DB->count_records('analytics_predictions', ['contextid' => $predictioncontextid]);
+ $npredictionactions = $DB->count_records(
+ 'analytics_prediction_actions',
+ ['predictionid' => $prediction->get_prediction_data()->id]
+ );
+ $nindicatorcalc = $DB->count_records('analytics_indicator_calc', ['contextid' => $predictioncontextid]);
\core_analytics\manager::cleanup();
// Nothing is incorrectly deleted.
- $this->assertEquals($npredictions, $DB->count_records('analytics_predictions',
- array('contextid' => $predictioncontextid)));
- $this->assertEquals($npredictionactions, $DB->count_records('analytics_prediction_actions',
- array('predictionid' => $prediction->get_prediction_data()->id)));
- $this->assertEquals($nindicatorcalc, $DB->count_records('analytics_indicator_calc',
- array('contextid' => $predictioncontextid)));
+ $this->assertEquals($npredictions, $DB->count_records(
+ 'analytics_predictions',
+ ['contextid' => $predictioncontextid]
+ ));
+ $this->assertEquals($npredictionactions, $DB->count_records(
+ 'analytics_prediction_actions',
+ ['predictionid' => $prediction->get_prediction_data()->id]
+ ));
+ $this->assertEquals($nindicatorcalc, $DB->count_records(
+ 'analytics_indicator_calc',
+ ['contextid' => $predictioncontextid]
+ ));
// Now we delete a context, the course predictions and prediction actions should be deleted.
$deletedcontext = \context::instance_by_id($predictioncontextid);
@@ -91,10 +98,12 @@ class manager_test extends \advanced_testcase {
\core_analytics\manager::cleanup();
- $this->assertEmpty($DB->count_records('analytics_predictions', array('contextid' => $predictioncontextid)));
- $this->assertEmpty($DB->count_records('analytics_prediction_actions',
- array('predictionid' => $prediction->get_prediction_data()->id)));
- $this->assertEmpty($DB->count_records('analytics_indicator_calc', array('contextid' => $predictioncontextid)));
+ $this->assertEmpty($DB->count_records('analytics_predictions', ['contextid' => $predictioncontextid]));
+ $this->assertEmpty($DB->count_records(
+ 'analytics_prediction_actions',
+ ['predictionid' => $prediction->get_prediction_data()->id]
+ ));
+ $this->assertEmpty($DB->count_records('analytics_indicator_calc', ['contextid' => $predictioncontextid]));
set_config('enabled_stores', '', 'tool_log');
get_log_manager(true);
@@ -111,7 +120,7 @@ class manager_test extends \advanced_testcase {
set_config('enabled_stores', 'logstore_standard', 'tool_log');
$target = \core_analytics\manager::get_target('test_target_course_level_shortname');
- $indicators = array('test_indicator_max', 'test_indicator_min', 'test_indicator_fullname');
+ $indicators = ['test_indicator_max', 'test_indicator_min', 'test_indicator_fullname'];
foreach ($indicators as $key => $indicator) {
$indicators[$key] = \core_analytics\manager::get_indicator($indicator);
}
@@ -119,10 +128,10 @@ class manager_test extends \advanced_testcase {
$model = \core_analytics\model::create($target, $indicators);
$modelobj = $model->get_model_obj();
- $coursepredict1 = $this->getDataGenerator()->create_course(array('visible' => 0));
- $coursepredict2 = $this->getDataGenerator()->create_course(array('visible' => 0));
- $coursetrain1 = $this->getDataGenerator()->create_course(array('visible' => 1));
- $coursetrain2 = $this->getDataGenerator()->create_course(array('visible' => 1));
+ $coursepredict1 = $this->getDataGenerator()->create_course(['visible' => 0]);
+ $coursepredict2 = $this->getDataGenerator()->create_course(['visible' => 0]);
+ $coursetrain1 = $this->getDataGenerator()->create_course(['visible' => 1]);
+ $coursetrain2 = $this->getDataGenerator()->create_course(['visible' => 1]);
$model->enable('\core\analytics\time_splitting\no_splitting');
@@ -139,9 +148,9 @@ class manager_test extends \advanced_testcase {
\core_analytics\manager::cleanup();
- $this->assertEmpty($DB->count_records('analytics_predict_samples', array('analysableid' => $coursepredict1->id)));
- $this->assertEmpty($DB->count_records('analytics_train_samples', array('analysableid' => $coursepredict1->id)));
- $this->assertEmpty($DB->count_records('analytics_used_analysables', array('analysableid' => $coursepredict1->id)));
+ $this->assertEmpty($DB->count_records('analytics_predict_samples', ['analysableid' => $coursepredict1->id]));
+ $this->assertEmpty($DB->count_records('analytics_train_samples', ['analysableid' => $coursepredict1->id]));
+ $this->assertEmpty($DB->count_records('analytics_used_analysables', ['analysableid' => $coursepredict1->id]));
set_config('enabled_stores', '', 'tool_log');
get_log_manager(true);
@@ -190,7 +199,7 @@ class manager_test extends \advanced_testcase {
$this->resetAfterTest();
// This is expected to run without an exception.
- $models = $this->load_models_from_fixture_file('no_teaching');
+ $models = self::load_models_from_fixture_file('no_teaching');
\core_analytics\manager::validate_models_declaration($models);
}
@@ -214,34 +223,34 @@ class manager_test extends \advanced_testcase {
*
* @return array of (string)testcase => [(array)models, (string)expected exception message]
*/
- public function validate_models_declaration_exceptions_provider() {
+ public static function validate_models_declaration_exceptions_provider(): array {
return [
'missing_target' => [
- $this->load_models_from_fixture_file('missing_target'),
+ self::load_models_from_fixture_file('missing_target'),
'Missing target declaration',
],
'invalid_target' => [
- $this->load_models_from_fixture_file('invalid_target'),
+ self::load_models_from_fixture_file('invalid_target'),
'Invalid target classname',
],
'missing_indicators' => [
- $this->load_models_from_fixture_file('missing_indicators'),
+ self::load_models_from_fixture_file('missing_indicators'),
'Missing indicators declaration',
],
'invalid_indicators' => [
- $this->load_models_from_fixture_file('invalid_indicators'),
+ self::load_models_from_fixture_file('invalid_indicators'),
'Invalid indicator classname',
],
'invalid_time_splitting' => [
- $this->load_models_from_fixture_file('invalid_time_splitting'),
+ self::load_models_from_fixture_file('invalid_time_splitting'),
'Invalid time splitting classname',
],
'invalid_time_splitting_fq' => [
- $this->load_models_from_fixture_file('invalid_time_splitting_fq'),
+ self::load_models_from_fixture_file('invalid_time_splitting_fq'),
'Expecting fully qualified time splitting classname',
],
'invalid_enabled' => [
- $this->load_models_from_fixture_file('invalid_enabled'),
+ self::load_models_from_fixture_file('invalid_enabled'),
'Cannot enable a model without time splitting method specified',
],
];
@@ -253,12 +262,12 @@ class manager_test extends \advanced_testcase {
* @param string $filename
* @return array
*/
- protected function load_models_from_fixture_file(string $filename) {
+ protected static function load_models_from_fixture_file(string $filename) {
global $CFG;
$models = null;
- require($CFG->dirroot.'/analytics/tests/fixtures/db_analytics_php/'.$filename.'.php');
+ require("{$CFG->dirroot}/analytics/tests/fixtures/db_analytics_php/{$filename}.php");
return $models;
}
@@ -430,9 +439,9 @@ class manager_test extends \advanced_testcase {
*/
public function test_model_declaration_identifier(): void {
- $noteaching1 = $this->load_models_from_fixture_file('no_teaching');
- $noteaching2 = $this->load_models_from_fixture_file('no_teaching');
- $noteaching3 = $this->load_models_from_fixture_file('no_teaching');
+ $noteaching1 = self::load_models_from_fixture_file('no_teaching');
+ $noteaching2 = self::load_models_from_fixture_file('no_teaching');
+ $noteaching3 = self::load_models_from_fixture_file('no_teaching');
// Same model declaration should always lead to same identifier.
$this->assertEquals(
@@ -474,9 +483,9 @@ class manager_test extends \advanced_testcase {
public function test_get_declared_target_and_indicators_instances(): void {
$this->resetAfterTest();
- $definition = $this->load_models_from_fixture_file('no_teaching');
+ $definition = self::load_models_from_fixture_file('no_teaching');
- list($target, $indicators) = \core_analytics\manager::get_declared_target_and_indicators_instances($definition[0]);
+ [$target, $indicators] = \core_analytics\manager::get_declared_target_and_indicators_instances($definition[0]);
$this->assertTrue($target instanceof \core_analytics\local\target\base);
$this->assertNotEmpty($indicators);
diff --git a/analytics/tests/prediction_actions_test.php b/analytics/tests/prediction_actions_test.php
index a7cfa1eaaea..08151f6e02e 100644
--- a/analytics/tests/prediction_actions_test.php
+++ b/analytics/tests/prediction_actions_test.php
@@ -136,7 +136,7 @@ class prediction_actions_test extends \advanced_testcase {
*
* @return array
*/
- public function execute_actions_provider(): array {
+ public static function execute_actions_provider(): array {
return [
'Empty actions with no filter' => [
[],
diff --git a/analytics/tests/prediction_test.php b/analytics/tests/prediction_test.php
index c20d811ceac..02c6ced49f5 100644
--- a/analytics/tests/prediction_test.php
+++ b/analytics/tests/prediction_test.php
@@ -342,14 +342,14 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
- public function provider_ml_training_and_prediction() {
+ public static function provider_ml_training_and_prediction(): array {
$cases = array(
'no_splitting' => array('\core\analytics\time_splitting\no_splitting', 0, 1),
'quarters' => array('\core\analytics\time_splitting\quarters', 3, 4)
);
// We need to test all system prediction processors.
- return $this->add_prediction_processors($cases);
+ return static::add_prediction_processors($cases);
}
/**
@@ -418,13 +418,13 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
- public function provider_ml_processors() {
+ public static function provider_ml_processors(): array {
$cases = [
'case' => [],
];
// We need to test all system prediction processors.
- return $this->add_prediction_processors($cases);
+ return static::add_prediction_processors($cases);
}
/**
* Test the system classifiers returns.
@@ -508,7 +508,7 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
- public function provider_ml_classifiers_return() {
+ public static function provider_ml_classifiers_return(): array {
// Using verbose options as the first argument for readability.
$cases = array(
'1-samples' => array('maybe', 1, [0]),
@@ -518,7 +518,7 @@ class prediction_test extends \advanced_testcase {
);
// We need to test all system prediction processors.
- return $this->add_prediction_processors($cases);
+ return static::add_prediction_processors($cases);
}
/**
@@ -582,13 +582,13 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
- public function provider_test_multi_classifier() {
+ public static function provider_test_multi_classifier(): array {
$cases = array(
'notimesplitting' => array('\core\analytics\time_splitting\no_splitting'),
);
// Add all system prediction processors.
- return $this->add_prediction_processors($cases);
+ return static::add_prediction_processors($cases);
}
/**
@@ -778,8 +778,7 @@ class prediction_test extends \advanced_testcase {
*
* @return array
*/
- public function provider_ml_test_evaluation_configuration() {
-
+ public static function provider_ml_test_evaluation_configuration(): array {
$cases = array(
'bad' => array(
'modelquality' => 'random',
@@ -798,7 +797,7 @@ class prediction_test extends \advanced_testcase {
)
)
);
- return $this->add_prediction_processors($cases);
+ return static::add_prediction_processors($cases);
}
/**
@@ -956,8 +955,7 @@ class prediction_test extends \advanced_testcase {
* @param array $cases
* @return array
*/
- protected function add_prediction_processors($cases) {
-
+ protected static function add_prediction_processors($cases): array {
$return = array();
if (defined('TEST_MLBACKEND_PYTHON_HOST') && defined('TEST_MLBACKEND_PYTHON_PORT')
diff --git a/auth/ldap/tests/auth_ldap_test.php b/auth/ldap/tests/auth_ldap_test.php
index 48ee545fbf6..b05a2da21fa 100644
--- a/auth/ldap/tests/auth_ldap_test.php
+++ b/auth/ldap/tests/auth_ldap_test.php
@@ -66,7 +66,7 @@ class auth_ldap_test extends \advanced_testcase {
*
* @return array[]
*/
- public function auth_ldap_provider() {
+ public static function auth_ldap_provider(): array {
$pagesizes = [1, 3, 5, 1000];
$subcontexts = [0, 1];
$combinations = [];
diff --git a/auth/lti/tests/auth_test.php b/auth/lti/tests/auth_test.php
index 4b585ef68a3..695d7d29412 100644
--- a/auth/lti/tests/auth_test.php
+++ b/auth/lti/tests/auth_test.php
@@ -27,7 +27,7 @@ namespace auth_lti;
class auth_test extends \advanced_testcase {
/** @var string issuer URL used for test cases. */
- protected $issuer = 'https://lms.example.org';
+ protected static string $issuer = 'https://lms.example.org';
/** @var int const representing cases where no PII is present. */
protected const PII_NONE = 0;
@@ -70,10 +70,13 @@ class auth_test extends \advanced_testcase {
* @param bool $includepicture whether to include a profile picture or not (slows tests, so defaults to false).
* @return array the users list.
*/
- protected function get_mock_users_with_ids(array $ids,
- string $role = 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor', bool $includenames = true,
- bool $includeemail = true, bool $includepicture = false): array {
-
+ protected static function get_mock_users_with_ids(
+ array $ids,
+ string $role = 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
+ bool $includenames = true,
+ bool $includeemail = true,
+ bool $includepicture = false,
+ ): array {
$users = [];
foreach ($ids as $id) {
$user = [
@@ -91,7 +94,7 @@ class auth_test extends \advanced_testcase {
unset($user['email']);
}
if ($includepicture) {
- $user['picture'] = $this->getExternalTestFileUrl('/test.jpg');
+ $user['picture'] = self::getExternalTestFileUrl('/test.jpg');
}
$users[] = $user;
}
@@ -137,7 +140,7 @@ class auth_test extends \advanced_testcase {
*/
protected function get_mock_launchdata_for_user(array $mockuser, array $mockmigration = []): array {
$data = [
- 'iss' => $this->issuer, // Must match registration in create_test_environment.
+ 'iss' => self::$issuer, // Must match registration in create_test_environment.
'aud' => '123', // Must match registration in create_test_environment.
'sub' => $mockuser['user_id'], // User id on the platform site.
'exp' => time() + 60,
@@ -286,12 +289,12 @@ class auth_test extends \advanced_testcase {
*
* @return array the test case data.
*/
- public function launch_data_provider(): array {
+ public static function launch_data_provider(): array {
return [
'New (unlinked) platform learner including PII, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -301,7 +304,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding names, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false
@@ -312,7 +315,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding emails, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
true,
@@ -324,7 +327,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding all PII, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -345,7 +348,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -374,7 +377,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -396,7 +399,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -425,7 +428,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -454,7 +457,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -483,7 +486,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -512,7 +515,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -540,7 +543,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -569,7 +572,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -591,7 +594,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform instructor including PII, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'
)[0],
@@ -601,7 +604,7 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform instructor excluding PII, no legacy user, no migration claim' => [
'legacy_data' => null,
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
false,
@@ -622,7 +625,7 @@ class auth_test extends \advanced_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'
)[0],
@@ -643,7 +646,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -654,7 +657,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -667,7 +670,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'
)[0],
@@ -678,7 +681,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
false,
@@ -691,7 +694,7 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => false,
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
false,
@@ -810,17 +813,17 @@ class auth_test extends \advanced_testcase {
*
* @return array the test case data.
*/
- public function membership_data_provider(): array {
+ public static function membership_data_provider(): array {
return [
'New (unlinked) platform learner including PII, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_ALL,
@@ -830,14 +833,14 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding PII, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
false
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_NONE,
@@ -847,13 +850,13 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding names, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_EMAILS_ONLY,
@@ -863,14 +866,14 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner excluding email, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
true,
false
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_NAMES_ONLY,
@@ -885,13 +888,13 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
'legacy_user_id' => '123-abc'
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_1',
'expected' => [
'PII' => self::PII_ALL,
@@ -906,12 +909,12 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_1',
'expected' => [
'PII' => self::PII_ALL,
@@ -926,12 +929,12 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['123-abc'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_1',
'expected' => [
'PII' => self::PII_ALL,
@@ -946,12 +949,12 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['123-abc'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_ABCDEF',
'expected' => [
'PII' => self::PII_ALL,
@@ -966,13 +969,13 @@ class auth_test extends \advanced_testcase {
'consumer_key' => 'CONSUMER_1',
],
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
'legacy_user_id' => '123-abc'
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_ALL,
@@ -982,13 +985,13 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform learner including PII, no legacy data, consumer key bound, legacy user id sent' => [
'legacy_data' => null,
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
'legacy_user_id' => '123-abc'
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => 'CONSUMER_1',
'expected' => [
'PII' => self::PII_ALL,
@@ -998,12 +1001,12 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform instructor including PII, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_ALL,
@@ -1013,14 +1016,14 @@ class auth_test extends \advanced_testcase {
'New (unlinked) platform instructor excluding PII, no legacy data, no consumer key bound, no legacy id' => [
'legacy_data' => null,
'membership_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
false,
false
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_NONE,
@@ -1031,12 +1034,12 @@ class auth_test extends \advanced_testcase {
'legacy_data' => null,
'launch_data' => [
'has_authenticated_before' => true,
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
],
- 'iss' => $this->issuer,
+ 'iss' => self::$issuer,
'legacy_consumer_key' => null,
'expected' => [
'PII' => self::PII_ALL,
@@ -1056,7 +1059,7 @@ class auth_test extends \advanced_testcase {
global $DB;
$auth = get_auth_plugin('lti');
$user = $this->getDataGenerator()->create_user();
- $mockiss = $this->issuer;
+ $mockiss = self::$issuer;
$mocksub = '1';
// Create a binding and verify it exists.
@@ -1068,7 +1071,7 @@ class auth_test extends \advanced_testcase {
$numusersbefore = $DB->count_records('user');
$matcheduser = $auth->find_or_create_user_from_launch(
$this->get_mock_launchdata_for_user(
- $this->get_mock_users_with_ids([$mocksub])[0]
+ self::get_mock_users_with_ids([$mocksub])[0]
)
);
$numusersafter = $DB->count_records('user');
@@ -1148,17 +1151,17 @@ class auth_test extends \advanced_testcase {
*
* @return array the test case data.
*/
- public function update_user_account_provider(): array {
+ public static function update_user_account_provider(): array {
return [
'Full PII included in both auths, no picture in either' => [
'first_launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -1171,7 +1174,7 @@ class auth_test extends \advanced_testcase {
],
'No PII included in both auths, no picture in either' => [
'first_launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -1179,7 +1182,7 @@ class auth_test extends \advanced_testcase {
)[0]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -1194,7 +1197,7 @@ class auth_test extends \advanced_testcase {
],
'First auth no PII, second auth including PII, no picture in either' => [
'first_launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -1202,7 +1205,7 @@ class auth_test extends \advanced_testcase {
)[0]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0],
@@ -1215,13 +1218,13 @@ class auth_test extends \advanced_testcase {
],
'First auth full PII, second auth no PII, no picture in either' => [
'first_launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
)[0]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false,
@@ -1236,13 +1239,13 @@ class auth_test extends \advanced_testcase {
],
'First auth full PII, second auth emails only, no picture in either' => [
'first_launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
)[0]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
false
@@ -1256,13 +1259,13 @@ class auth_test extends \advanced_testcase {
],
'First auth full PII, second auth names only, no picture in either' => [
'first_launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
)[0]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
true,
@@ -1277,13 +1280,13 @@ class auth_test extends \advanced_testcase {
],
'Full PII included in both auths, picture included in the second auth' => [
'first_launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0]
],
'launch_data' => [
- 'user' => $this->get_mock_users_with_ids(
+ 'user' => self::get_mock_users_with_ids(
['1'],
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner',
true,
diff --git a/availability/condition/completion/tests/condition_test.php b/availability/condition/completion/tests/condition_test.php
index 4610cb5065a..5d97455f71b 100644
--- a/availability/condition/completion/tests/condition_test.php
+++ b/availability/condition/completion/tests/condition_test.php
@@ -470,7 +470,7 @@ class condition_test extends \advanced_testcase {
$this->assertMatchesRegularExpression($description, $information);
}
- public function previous_activity_data(): array {
+ public static function previous_activity_data(): array {
// Assign grade, condition, activity to complete, activity to test, result, resultnot, description.
return [
'Missing previous activity complete' => [
@@ -635,7 +635,7 @@ class condition_test extends \advanced_testcase {
}
- public function section_previous_activity_data(): array {
+ public static function section_previous_activity_data(): array {
return [
// Condition, Activity completion, section to test, result, resultnot, description.
'Completion complete Section with no previous activity' => [
diff --git a/backup/moodle2/tests/backup_xml_transformer_test.php b/backup/moodle2/tests/backup_xml_transformer_test.php
index 54c8656d714..5bd42cf0abf 100644
--- a/backup/moodle2/tests/backup_xml_transformer_test.php
+++ b/backup/moodle2/tests/backup_xml_transformer_test.php
@@ -49,7 +49,7 @@ class backup_xml_transformer_test extends \advanced_testcase {
*
* @return array
*/
- public function filephp_links_replace_data_provider() {
+ public static function filephp_links_replace_data_provider(): array {
return array(
array('http://test.test/', 'http://test.test/'),
array('http://test.test/file.php/1', 'http://test.test/file.php/1'),
diff --git a/backup/moodle2/tests/restore_gradebook_structure_step_test.php b/backup/moodle2/tests/restore_gradebook_structure_step_test.php
index aec1a12e5a1..21e2f4aa742 100644
--- a/backup/moodle2/tests/restore_gradebook_structure_step_test.php
+++ b/backup/moodle2/tests/restore_gradebook_structure_step_test.php
@@ -37,12 +37,13 @@ class restore_gradebook_structure_step_test extends \advanced_testcase {
*
* @return array
*/
- public function rewrite_step_backup_file_for_legacy_freeze_provider() {
+ public static function rewrite_step_backup_file_for_legacy_freeze_provider(): array {
$fixturesdir = realpath(__DIR__ . '/fixtures/rewrite_step_backup_file_for_legacy_freeze/');
$tests = [];
$iterator = new \RecursiveIteratorIterator(
- new \RecursiveDirectoryIterator($fixturesdir),
- \RecursiveIteratorIterator::LEAVES_ONLY);
+ new \RecursiveDirectoryIterator($fixturesdir),
+ \RecursiveIteratorIterator::LEAVES_ONLY,
+ );
foreach ($iterator as $sourcefile) {
$pattern = '/\.test$/';
diff --git a/backup/util/dbops/tests/restore_dbops_test.php b/backup/util/dbops/tests/restore_dbops_test.php
index 389a9814366..cc9cb010bee 100644
--- a/backup/util/dbops/tests/restore_dbops_test.php
+++ b/backup/util/dbops/tests/restore_dbops_test.php
@@ -124,8 +124,7 @@ class restore_dbops_test extends \advanced_testcase {
/**
* Data provider for {@link test_precheck_user()}
*/
- public function precheck_user_provider() {
-
+ public static function precheck_user_provider(): array {
$emailmultiplier = [
'shortmail' => 'normalusername@example.com',
'longmail' => str_repeat('a', 100) // It's not validated, hence any string is ok.
@@ -135,7 +134,7 @@ class restore_dbops_test extends \advanced_testcase {
foreach ($emailmultiplier as $emailk => $email) {
// Get the related cases.
- $cases = $this->precheck_user_cases($email);
+ $cases = self::precheck_user_cases($email);
// Rename them (keys).
foreach ($cases as $key => $case) {
$providercases[$key . ' - ' . $emailk] = $case;
@@ -150,7 +149,7 @@ class restore_dbops_test extends \advanced_testcase {
*
* @param string $email
*/
- private function precheck_user_cases($email) {
+ private static function precheck_user_cases($email) {
global $CFG;
$baseuserarr = [
diff --git a/backup/util/helper/tests/restore_structure_parser_processor_test.php b/backup/util/helper/tests/restore_structure_parser_processor_test.php
index 7f74ec7cef1..6852b0eddcc 100644
--- a/backup/util/helper/tests/restore_structure_parser_processor_test.php
+++ b/backup/util/helper/tests/restore_structure_parser_processor_test.php
@@ -53,7 +53,7 @@ class restore_structure_parser_processor_test extends advanced_testcase {
*
* @return array
*/
- public function process_cdata_data_provider() {
+ public static function process_cdata_data_provider(): array {
return array(
array(null, null, true),
array("$@NULL@$", null, true),
diff --git a/badges/tests/badgeslib_test.php b/badges/tests/badgeslib_test.php
index 1b14b5a961f..41ffdc26409 100644
--- a/badges/tests/badgeslib_test.php
+++ b/badges/tests/badgeslib_test.php
@@ -481,7 +481,7 @@ class badgeslib_test extends advanced_testcase {
}
- public function data_for_message_from_template() {
+ public static function data_for_message_from_template(): array {
return array(
array(
'This is a message with no variables',
@@ -1231,7 +1231,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
- public function save_backpack_credentials_provider(): array {
+ public static function save_backpack_credentials_provider(): array {
return [
'Empty fields' => [
false,
@@ -1299,7 +1299,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
- public function badges_save_external_backpack_provider() {
+ public static function badges_save_external_backpack_provider(): array {
$data = [
'apiversion' => 2,
'backpackapiurl' => 'https://api.ca.badgr.io/v2',
@@ -1416,7 +1416,7 @@ class badgeslib_test extends advanced_testcase {
/**
* Provider for test_badges_(create/update)_site_backpack
*/
- public function badges_create_site_backpack_provider() {
+ public static function badges_create_site_backpack_provider(): array {
return [
"Test as admin user - creation test" => [true, true],
"Test as admin user - update test" => [true, false],
@@ -1587,7 +1587,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
- public function badges_get_site_primary_backpack_provider() {
+ public static function badges_get_site_primary_backpack_provider(): array {
return [
"Test with auth details" => [true],
"Test without auth details" => [false],
@@ -1642,7 +1642,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
- public function badges_change_sortorder_backpacks_provider(): array {
+ public static function badges_change_sortorder_backpacks_provider(): array {
return [
"Test up" => [
'backpacktomove' => 1,
@@ -1696,7 +1696,7 @@ class badgeslib_test extends advanced_testcase {
* Data provider for test_badges_generate_badgr_open_url
* @return array
*/
- public function badgr_open_url_generator() {
+ public static function badgr_open_url_generator(): array {
return [
'Badgr Assertion URL test' => [
OPEN_BADGES_V2_TYPE_ASSERTION, "https://api.ca.badgr.io/public/assertions/123455"
@@ -1743,7 +1743,7 @@ class badgeslib_test extends advanced_testcase {
*
* @return array
*/
- public function badges_external_get_mapping_provider() {
+ public static function badges_external_get_mapping_provider(): array {
return [
"Get the site backpack value" => [
1234, 4321, 'id', 'sitebackpackid'
diff --git a/badges/tests/output/manage_badge_action_bar_test.php b/badges/tests/output/manage_badge_action_bar_test.php
index ef9b8baf58e..754849657d9 100644
--- a/badges/tests/output/manage_badge_action_bar_test.php
+++ b/badges/tests/output/manage_badge_action_bar_test.php
@@ -36,7 +36,7 @@ class manage_badge_action_bar_test extends \advanced_testcase {
*
* @return array
*/
- public function generate_badge_navigation_provider(): array {
+ public static function generate_badge_navigation_provider(): array {
return [
"Test tertiary nav as an editing teacher" => [
"editingteacher", [
diff --git a/badges/tests/reportbuilder/datasource/users_test.php b/badges/tests/reportbuilder/datasource/users_test.php
index b83f36f60f1..96da2707cbc 100644
--- a/badges/tests/reportbuilder/datasource/users_test.php
+++ b/badges/tests/reportbuilder/datasource/users_test.php
@@ -211,7 +211,7 @@ class users_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
- public function datasource_filters_provider(): array {
+ public static function datasource_filters_provider(): array {
return [
// User.
'Filter user fullname' => ['user:fullname', [
diff --git a/blocks/myoverview/tests/privacy/provider_test.php b/blocks/myoverview/tests/privacy/provider_test.php
index 72b7eb1784d..482ef8c69a0 100644
--- a/blocks/myoverview/tests/privacy/provider_test.php
+++ b/blocks/myoverview/tests/privacy/provider_test.php
@@ -71,7 +71,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return array(
array('block_myoverview_user_sort_preference', 'lastaccessed', ''),
array('block_myoverview_user_sort_preference', 'title', ''),
diff --git a/blocks/rss_client/tests/cron_test.php b/blocks/rss_client/tests/cron_test.php
index 21379fb617a..9cdaeb1d2c4 100644
--- a/blocks/rss_client/tests/cron_test.php
+++ b/blocks/rss_client/tests/cron_test.php
@@ -67,7 +67,7 @@ class cron_test extends \advanced_testcase {
*
* @return array
*/
- public function skip_time_increase_provider(): array {
+ public static function skip_time_increase_provider(): array {
return [
'Never failed' => [
'skiptime' => 0,
diff --git a/blocks/timeline/tests/privacy/provider_test.php b/blocks/timeline/tests/privacy/provider_test.php
index b6f404c9a07..bfced494ccf 100644
--- a/blocks/timeline/tests/privacy/provider_test.php
+++ b/blocks/timeline/tests/privacy/provider_test.php
@@ -76,7 +76,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return array(
array('block_timeline_user_sort_preference', 'sortbydates', ''),
array('block_timeline_user_sort_preference', 'sortbycourses', ''),
diff --git a/blog/tests/reportbuilder/datasource/blogs_test.php b/blog/tests/reportbuilder/datasource/blogs_test.php
index 3db23840c8c..b823f40894c 100644
--- a/blog/tests/reportbuilder/datasource/blogs_test.php
+++ b/blog/tests/reportbuilder/datasource/blogs_test.php
@@ -175,7 +175,7 @@ class blogs_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
- public function datasource_filters_provider(): array {
+ public static function datasource_filters_provider(): array {
return [
'Filter title' => ['subject', 'Cool', 'blog:title', [
'blog:title_operator' => text::CONTAINS,
diff --git a/cache/stores/redis/tests/compressor_test.php b/cache/stores/redis/tests/compressor_test.php
index 6c2574bc150..1868e7ad39b 100644
--- a/cache/stores/redis/tests/compressor_test.php
+++ b/cache/stores/redis/tests/compressor_test.php
@@ -105,7 +105,7 @@ class compressor_test extends \advanced_testcase {
*
* @return array
*/
- public function provider_for_test_it_works_with_different_types() {
+ public static function provider_for_test_it_works_with_different_types(): array {
$object = new \stdClass();
$object->field = 'value';
@@ -147,7 +147,7 @@ class compressor_test extends \advanced_testcase {
public function test_it_works_with_different_types_for_many(): void {
$store = $this->create_store(cachestore_redis::COMPRESSOR_PHP_GZIP, \Redis::SERIALIZER_PHP);
- $provider = $this->provider_for_test_it_works_with_different_types();
+ $provider = self::provider_for_test_it_works_with_different_types();
$keys = [];
$values = [];
$expected = [];
@@ -166,7 +166,7 @@ class compressor_test extends \advanced_testcase {
*
* @return array
*/
- public function provider_for_tests_setget() {
+ public static function provider_for_tests_setget(): array {
if (!cachestore_redis::are_requirements_met()) {
// Even though we skip all tests in this case, this provider can still show warnings about non-existing class.
return [];
diff --git a/calendar/tests/action_event_test.php b/calendar/tests/action_event_test.php
index 55d4c5cd0e4..b73ed20f867 100644
--- a/calendar/tests/action_event_test.php
+++ b/calendar/tests/action_event_test.php
@@ -45,7 +45,7 @@ class action_event_test extends \advanced_testcase {
/**
* Test event class getters.
*
- * @dataProvider getters_testcases()
+ * @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams): void {
@@ -64,7 +64,7 @@ class action_event_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
- public function getters_testcases() {
+ public static function getters_testcases(): array {
return [
'Dataset 1' => [
'constructorparams' => [
diff --git a/calendar/tests/action_test.php b/calendar/tests/action_test.php
index 4ecb81378da..ea84559f63b 100644
--- a/calendar/tests/action_test.php
+++ b/calendar/tests/action_test.php
@@ -29,7 +29,7 @@ class action_test extends \advanced_testcase {
/**
* Test action class getters.
*
- * @dataProvider getters_testcases()
+ * @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams): void {
@@ -52,7 +52,7 @@ class action_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
- public function getters_testcases() {
+ public static function getters_testcases(): array {
return [
'Dataset 1' => [
'constructorparams' => [
diff --git a/calendar/tests/calendar_event_exporter_test.php b/calendar/tests/calendar_event_exporter_test.php
index 5b9eb1bed0f..53496c88304 100644
--- a/calendar/tests/calendar_event_exporter_test.php
+++ b/calendar/tests/calendar_event_exporter_test.php
@@ -34,7 +34,7 @@ class calendar_event_exporter_test extends \advanced_testcase {
* Data provider for the timestamp min limit test case to confirm
* that the minimum time limit is set correctly on the boundary cases.
*/
- public function get_timestamp_min_limit_test_cases() {
+ public static function get_timestamp_min_limit_test_cases(): array {
$now = time();
$todaymidnight = usergetmidnight($now);
$tomorrowmidnight = $todaymidnight + DAYSECS;
@@ -70,7 +70,7 @@ class calendar_event_exporter_test extends \advanced_testcase {
}
/**
- * @dataProvider get_timestamp_min_limit_test_cases()
+ * @dataProvider get_timestamp_min_limit_test_cases
*/
public function test_get_timestamp_min_limit($starttime, $min, $expected): void {
$class = calendar_event_exporter::class;
@@ -90,7 +90,7 @@ class calendar_event_exporter_test extends \advanced_testcase {
* Data provider for the timestamp max limit test case to confirm
* that the maximum time limit is set correctly on the boundary cases.
*/
- public function get_timestamp_max_limit_test_cases() {
+ public static function get_timestamp_max_limit_test_cases(): array {
$now = time();
$todaymidnight = usergetmidnight($now);
$yesterdaymidnight = $todaymidnight - DAYSECS;
@@ -126,7 +126,7 @@ class calendar_event_exporter_test extends \advanced_testcase {
}
/**
- * @dataProvider get_timestamp_max_limit_test_cases()
+ * @dataProvider get_timestamp_max_limit_test_cases
*/
public function test_get_timestamp_max_limit($starttime, $max, $expected): void {
$class = calendar_event_exporter::class;
diff --git a/calendar/tests/container_test.php b/calendar/tests/container_test.php
index 3a721a88691..ed56d957af2 100644
--- a/calendar/tests/container_test.php
+++ b/calendar/tests/container_test.php
@@ -69,7 +69,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory correctly creates instances of events.
*
- * @dataProvider get_event_factory_testcases()
+ * @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_create_instance($dbrow): void {
@@ -130,7 +130,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory deals with invisible modules properly as admin.
*
- * @dataProvider get_event_factory_testcases()
+ * @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_module_visibility_is_toggled_as_admin($dbrow): void {
@@ -156,7 +156,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory deals with invisible modules properly as a guest.
*
- * @dataProvider get_event_factory_testcases()
+ * @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_module_visibility_is_toggled_as_guest($dbrow): void {
@@ -185,7 +185,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory deals with invisible courses as an admin.
*
- * @dataProvider get_event_factory_testcases()
+ * @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_course_visibility_is_toggled_as_admin($dbrow): void {
@@ -210,7 +210,7 @@ class container_test extends \advanced_testcase {
/**
* Test that the event factory deals with invisible courses as a student.
*
- * @dataProvider get_event_factory_testcases()
+ * @dataProvider get_event_factory_testcases
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_course_visibility_is_toggled_as_student($dbrow): void {
@@ -505,7 +505,7 @@ class container_test extends \advanced_testcase {
/**
* Test cases for the get event factory test.
*/
- public function get_event_factory_testcases() {
+ public static function get_event_factory_testcases(): array {
return [
'Data set 1' => [
'dbrow' => (object)[
diff --git a/calendar/tests/event_description_test.php b/calendar/tests/event_description_test.php
index d071dbe394c..05bc94410cc 100644
--- a/calendar/tests/event_description_test.php
+++ b/calendar/tests/event_description_test.php
@@ -29,7 +29,7 @@ class event_description_test extends \advanced_testcase {
/**
* Test event description class getters.
*
- * @dataProvider getters_testcases()
+ * @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams): void {
@@ -45,7 +45,7 @@ class event_description_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
- public function getters_testcases() {
+ public static function getters_testcases(): array {
return [
'Dataset 1' => [
'constructorparams' => [
diff --git a/calendar/tests/event_factory_test.php b/calendar/tests/event_factory_test.php
index b571aa7ea90..34226b9f814 100644
--- a/calendar/tests/event_factory_test.php
+++ b/calendar/tests/event_factory_test.php
@@ -35,7 +35,7 @@ class event_factory_test extends \advanced_testcase {
/**
* Test event class getters.
*
- * @dataProvider create_instance_testcases()
+ * @dataProvider create_instance_testcases
* @param \stdClass $dbrow Row from the event table.
* @param callable $actioncallbackapplier Action callback applier.
* @param callable $visibilitycallbackapplier Visibility callback applier.
@@ -346,7 +346,7 @@ class event_factory_test extends \advanced_testcase {
*
* @return array Array of testcases.
*/
- public function create_instance_testcases() {
+ public static function create_instance_testcases(): array {
return [
'Sample event record with event exposed' => [
'dbrow' => (object)[
diff --git a/calendar/tests/event_test.php b/calendar/tests/event_test.php
index 150018ea088..433a5d3bdbd 100644
--- a/calendar/tests/event_test.php
+++ b/calendar/tests/event_test.php
@@ -36,7 +36,7 @@ class event_test extends \advanced_testcase {
/**
* Test event class getters.
*
- * @dataProvider getters_testcases()
+ * @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams): void {
@@ -71,7 +71,7 @@ class event_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
- public function getters_testcases() {
+ public static function getters_testcases(): array {
$lamecallable = function($id) {
return (object)['id' => $id, 'modname' => 'assign'];
};
diff --git a/calendar/tests/event_times_test.php b/calendar/tests/event_times_test.php
index 22f21b234b2..aec5d9e928b 100644
--- a/calendar/tests/event_times_test.php
+++ b/calendar/tests/event_times_test.php
@@ -29,7 +29,7 @@ class event_times_test extends \advanced_testcase {
/**
* Test event times class getters.
*
- * @dataProvider getters_testcases()
+ * @dataProvider getters_testcases
* @param array $constructorparams Associative array of constructor parameters.
*/
public function test_getters($constructorparams): void {
@@ -51,7 +51,7 @@ class event_times_test extends \advanced_testcase {
/**
* Test cases for getters test.
*/
- public function getters_testcases() {
+ public static function getters_testcases(): array {
return [
'Dataset 1' => [
'constructorparams' => [
diff --git a/calendar/tests/externallib_test.php b/calendar/tests/externallib_test.php
index 02b9c47a4bc..d98e2b3b509 100644
--- a/calendar/tests/externallib_test.php
+++ b/calendar/tests/externallib_test.php
@@ -2797,7 +2797,7 @@ class externallib_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
+ public static function get_calendar_event_by_id_prevent_read_other_users_events_data_provider(): array {
$syscontext = \context_system::instance();
$managerrole = 'manager';
return [
@@ -2868,7 +2868,7 @@ class externallib_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function edit_or_delete_other_users_events_data_provider(): array {
+ public static function edit_or_delete_other_users_events_data_provider(): array {
$syscontext = \context_system::instance();
$managerrole = 'manager';
return [
diff --git a/calendar/tests/lib_test.php b/calendar/tests/lib_test.php
index 6d8b59a4ad2..84462842633 100644
--- a/calendar/tests/lib_test.php
+++ b/calendar/tests/lib_test.php
@@ -1228,7 +1228,7 @@ class lib_test extends \advanced_testcase {
*
* @return array[]
*/
- public function calendar_format_event_location_provider(): array {
+ public static function calendar_format_event_location_provider(): array {
return [
'Empty' => ['', ''],
'Text' => ['Barcelona', 'Barcelona'],
diff --git a/calendar/tests/std_proxy_test.php b/calendar/tests/std_proxy_test.php
index 2dc7028848a..9d2d6735104 100644
--- a/calendar/tests/std_proxy_test.php
+++ b/calendar/tests/std_proxy_test.php
@@ -116,7 +116,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test cases for proxying test.
*/
- public function proxy_testcases() {
+ public static function proxy_testcases(): array {
return [
'Object 1 member 1' => [
1,
@@ -154,7 +154,7 @@ class std_proxy_test extends \advanced_testcase {
/**
* Test cases for getting and setting tests.
*/
- public function get_set_testcases() {
+ public static function get_set_testcases(): array {
return [
'Object 1' => [1],
'Object 2' => [5]
diff --git a/cohort/tests/reportbuilder/datasource/cohorts_test.php b/cohort/tests/reportbuilder/datasource/cohorts_test.php
index 455209c33c1..a44fcdd2eff 100644
--- a/cohort/tests/reportbuilder/datasource/cohorts_test.php
+++ b/cohort/tests/reportbuilder/datasource/cohorts_test.php
@@ -145,7 +145,7 @@ class cohorts_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
- public function datasource_filters_provider(): array {
+ public static function datasource_filters_provider(): array {
return [
// Cohort.
'Filter cohort' => ['cohort:cohortselect', [
diff --git a/comment/tests/reportbuilder/datasource/comments_test.php b/comment/tests/reportbuilder/datasource/comments_test.php
index 177e9ed5798..cc8d81669fc 100644
--- a/comment/tests/reportbuilder/datasource/comments_test.php
+++ b/comment/tests/reportbuilder/datasource/comments_test.php
@@ -136,7 +136,7 @@ class comments_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
- public function datasource_filters_provider(): array {
+ public static function datasource_filters_provider(): array {
return [
// Comment.
'Filter content' => ['comment:content', [
diff --git a/completion/tests/activity_custom_completion_test.php b/completion/tests/activity_custom_completion_test.php
index 12be3e1d3c4..0323c2ffebf 100644
--- a/completion/tests/activity_custom_completion_test.php
+++ b/completion/tests/activity_custom_completion_test.php
@@ -48,7 +48,7 @@ class activity_custom_completion_test extends advanced_testcase {
/**
* Data provider for test_get_overall_completion_state().
*/
- public function overall_completion_state_provider(): array {
+ public static function overall_completion_state_provider(): array {
global $CFG;
require_once($CFG->libdir . '/completionlib.php');
return [
@@ -134,7 +134,7 @@ class activity_custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function validate_rule_provider() {
+ public static function validate_rule_provider(): array {
return [
'Not defined' => [
false, true, coding_exception::class
diff --git a/completion/tests/bulk_update_test.php b/completion/tests/bulk_update_test.php
index b6b2db80fb5..af9e45ea83c 100644
--- a/completion/tests/bulk_update_test.php
+++ b/completion/tests/bulk_update_test.php
@@ -36,7 +36,7 @@ class bulk_update_test extends \advanced_testcase {
* Provider for test_bulk_form_submit_single
* @return array
*/
- public function bulk_form_submit_single_provider() {
+ public static function bulk_form_submit_single_provider(): array {
return [
'assign-1' => ['assign', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1]],
'assign-2' => ['assign', ['completion' => COMPLETION_TRACKING_MANUAL]],
@@ -184,7 +184,7 @@ class bulk_update_test extends \advanced_testcase {
* Provider for test_bulk_form_submit_multiple
* @return array
*/
- public function bulk_form_submit_multiple_provider() {
+ public static function bulk_form_submit_multiple_provider(): array {
return [
'Several modules with the same module type (choice)' => [
[
diff --git a/completion/tests/cm_completion_details_test.php b/completion/tests/cm_completion_details_test.php
index 2b98c943068..34a75f8d9d9 100644
--- a/completion/tests/cm_completion_details_test.php
+++ b/completion/tests/cm_completion_details_test.php
@@ -105,7 +105,7 @@ class cm_completion_details_test extends advanced_testcase {
*
* @return array[]
*/
- public function has_completion_provider(): array {
+ public static function has_completion_provider(): array {
return [
'Automatic' => [
COMPLETION_TRACKING_AUTOMATIC, true
@@ -138,7 +138,7 @@ class cm_completion_details_test extends advanced_testcase {
*
* @return array[]
*/
- public function is_automatic_provider(): array {
+ public static function is_automatic_provider(): array {
return [
'Automatic' => [
COMPLETION_TRACKING_AUTOMATIC, true
@@ -171,7 +171,7 @@ class cm_completion_details_test extends advanced_testcase {
*
* @return array[]
*/
- public function is_manual_provider(): array {
+ public static function is_manual_provider(): array {
return [
'Automatic' => [
COMPLETION_TRACKING_AUTOMATIC, false
@@ -203,7 +203,7 @@ class cm_completion_details_test extends advanced_testcase {
* Data provider for test_get_overall_completion().
* @return array[]
*/
- public function overall_completion_provider(): array {
+ public static function overall_completion_provider(): array {
return [
'Complete' => [COMPLETION_COMPLETE],
'Incomplete' => [COMPLETION_INCOMPLETE],
@@ -362,7 +362,7 @@ class cm_completion_details_test extends advanced_testcase {
* Data provider for test_get_details().
* @return array[]
*/
- public function get_details_provider() {
+ public static function get_details_provider(): array {
return [
'No completion tracking' => [
COMPLETION_TRACKING_NONE, null, null, null, []
@@ -523,7 +523,7 @@ class cm_completion_details_test extends advanced_testcase {
* Data provider for test_get_details_custom_order().
* @return array[]
*/
- public function get_details_custom_order_provider() {
+ public static function get_details_custom_order_provider(): array {
return [
'Custom and view/grade standard conditions, view first and grade last' => [
true,
diff --git a/completion/tests/generator_test.php b/completion/tests/generator_test.php
index b10de8bdfbf..7a987662d42 100644
--- a/completion/tests/generator_test.php
+++ b/completion/tests/generator_test.php
@@ -80,7 +80,7 @@ class generator_test extends \advanced_testcase {
* Data provider for test_create_default_completion().
* @return array[]
*/
- public function create_default_completion_provider(): array {
+ public static function create_default_completion_provider(): array {
global $SITE;
return [
diff --git a/contentbank/contenttype/h5p/tests/content_h5p_test.php b/contentbank/contenttype/h5p/tests/content_h5p_test.php
index a1b982f88ee..ad3e6960ff0 100644
--- a/contentbank/contenttype/h5p/tests/content_h5p_test.php
+++ b/contentbank/contenttype/h5p/tests/content_h5p_test.php
@@ -138,7 +138,7 @@ class content_h5p_test extends \advanced_testcase {
*
* @return array
*/
- public function is_view_allowed_provider(): array {
+ public static function is_view_allowed_provider(): array {
return [
'Editing teacher with all libraries enabled' => [
'role' => 'editingteacher',
diff --git a/contentbank/tests/content_test.php b/contentbank/tests/content_test.php
index a0dac533b6f..8dbe36e3b50 100644
--- a/contentbank/tests/content_test.php
+++ b/contentbank/tests/content_test.php
@@ -74,7 +74,7 @@ class content_test extends \advanced_testcase {
*
* @return array
*/
- public function set_name_provider() {
+ public static function set_name_provider(): array {
return [
'Standard name' => ['New name', 'New name'],
'Name with digits' => ['Today is 17/04/2017', 'Today is 17/04/2017'],
diff --git a/contentbank/tests/contentbank_test.php b/contentbank/tests/contentbank_test.php
index 1017e52b787..905f3c2f339 100644
--- a/contentbank/tests/contentbank_test.php
+++ b/contentbank/tests/contentbank_test.php
@@ -65,7 +65,7 @@ class contentbank_test extends advanced_testcase {
*
* @return array
*/
- public function get_extension_provider() {
+ public static function get_extension_provider(): array {
return [
'H5P file' => ['something.h5p', '.h5p'],
'PDF file' => ['something.pdf', '.pdf']
@@ -95,7 +95,7 @@ class contentbank_test extends advanced_testcase {
*
* @return array
*/
- public function get_extension_supporters_provider() {
+ public static function get_extension_supporters_provider(): array {
return [
'H5P first' => [['.h5p' => ['h5p', 'testable']], '.h5p', 'h5p'],
'Testable first (but upload not implemented)' => [['.h5p' => ['testable', 'h5p']], '.h5p', 'h5p'],
@@ -259,7 +259,7 @@ class contentbank_test extends advanced_testcase {
*
* @return array
*/
- public function search_contents_provider(): array {
+ public static function search_contents_provider(): array {
return [
'Search all content in all contexts' => [
@@ -519,7 +519,7 @@ class contentbank_test extends advanced_testcase {
*
* @return array
*/
- public function get_contenttypes_with_capability_feature_provider(): array {
+ public static function get_contenttypes_with_capability_feature_provider(): array {
return [
'no-contenttypes_enabled' => [
'contenttypesenabled' => [],
diff --git a/contentbank/tests/contenttype_test.php b/contentbank/tests/contenttype_test.php
index 3dd4cd49b56..bc783a8d8b1 100644
--- a/contentbank/tests/contenttype_test.php
+++ b/contentbank/tests/contenttype_test.php
@@ -240,7 +240,7 @@ class contenttype_test extends \advanced_testcase {
*
* @return array
*/
- public function upload_content_provider() {
+ public static function upload_content_provider(): array {
return [
'With record' => [true],
'Without record' => [false],
@@ -449,7 +449,7 @@ class contenttype_test extends \advanced_testcase {
*
* @return array
*/
- public function rename_content_provider() {
+ public static function rename_content_provider(): array {
return [
'Standard name' => ['New name', 'New name', true],
'Name with digits' => ['Today is 17/04/2017', 'Today is 17/04/2017', true],
diff --git a/contentbank/tests/external/rename_content_test.php b/contentbank/tests/external/rename_content_test.php
index 45463c68e27..0c237f0497e 100644
--- a/contentbank/tests/external/rename_content_test.php
+++ b/contentbank/tests/external/rename_content_test.php
@@ -50,7 +50,7 @@ class rename_content_test extends \externallib_advanced_testcase {
*
* @return array
*/
- public function rename_content_provider() {
+ public static function rename_content_provider(): array {
return [
'Standard name' => ['New name', 'New name', true],
'Name with digits' => ['Today is 17/04/2017', 'Today is 17/04/2017', true],
diff --git a/course/format/tests/base_test.php b/course/format/tests/base_test.php
index 859355ca2b4..aba4bf5e0d3 100644
--- a/course/format/tests/base_test.php
+++ b/course/format/tests/base_test.php
@@ -281,7 +281,7 @@ class base_test extends advanced_testcase {
*
* @return array the testing scenarios
*/
- public function get_output_classname_provider(): array {
+ public static function get_output_classname_provider(): array {
return [
'overridden class' => [
'find' => 'state\\course',
@@ -516,7 +516,7 @@ class base_test extends advanced_testcase {
*
* @return array the testing scenarios
*/
- public function delete_format_data_provider(): array {
+ public static function delete_format_data_provider(): array {
return [
'direct call' => [
'usehook' => false
@@ -604,7 +604,7 @@ class base_test extends advanced_testcase {
*
* @return array the testing scenarios
*/
- public function get_format_string_provider(): array {
+ public static function get_format_string_provider(): array {
return [
'Existing in format lang' => [
'key' => 'addsection',
@@ -683,7 +683,7 @@ class base_test extends advanced_testcase {
*
* @return array the testing scenarios
*/
- public function move_section_after_provider(): array {
+ public static function move_section_after_provider(): array {
return [
'Move top' => [
'movesection' => 'section3',
@@ -794,7 +794,7 @@ class base_test extends advanced_testcase {
*
* @return array the testing scenarios
*/
- public function get_non_ajax_cm_action_url_provider(): array {
+ public static function get_non_ajax_cm_action_url_provider(): array {
return [
'duplicate' => [
'action' => 'cmDuplicate',
diff --git a/course/format/tests/external/get_state_test.php b/course/format/tests/external/get_state_test.php
index 3fd456a24e4..fa3dcdc936f 100644
--- a/course/format/tests/external/get_state_test.php
+++ b/course/format/tests/external/get_state_test.php
@@ -184,7 +184,7 @@ class get_state_test extends \externallib_advanced_testcase {
*
* @return array
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
return [
// ROLES. Testing behaviour depending on the user role calling the method.
'Admin user should work' => [
diff --git a/course/format/tests/external/update_course_test.php b/course/format/tests/external/update_course_test.php
index 31150bbe90f..a46beaba4b8 100644
--- a/course/format/tests/external/update_course_test.php
+++ b/course/format/tests/external/update_course_test.php
@@ -104,7 +104,7 @@ class update_course_test extends \externallib_advanced_testcase {
*
* @return array of testing scenarios
*/
- public function execute_course_state_provider(): array {
+ public static function execute_course_state_provider(): array {
return [
'Execute a core state action (cm_state)' => [
'format' => 'topics',
diff --git a/course/format/tests/output/local/state/cm_test.php b/course/format/tests/output/local/state/cm_test.php
index ddf82e28a92..696ad302a92 100644
--- a/course/format/tests/output/local/state/cm_test.php
+++ b/course/format/tests/output/local/state/cm_test.php
@@ -151,7 +151,7 @@ class cm_test extends \advanced_testcase {
*
* @return array
*/
- public function hasrestrictions_state_provider(): array {
+ public static function hasrestrictions_state_provider(): array {
return [
// Teacher scenarios (topics).
'Teacher, Topics, can edit, has availability and is available' => [
diff --git a/course/format/tests/output/local/state/section_test.php b/course/format/tests/output/local/state/section_test.php
index 2cd0566a898..bca8ac3901f 100644
--- a/course/format/tests/output/local/state/section_test.php
+++ b/course/format/tests/output/local/state/section_test.php
@@ -143,7 +143,7 @@ class section_test extends \advanced_testcase {
*
* @return array
*/
- public function hasrestrictions_state_provider(): array {
+ public static function hasrestrictions_state_provider(): array {
return [
// Teacher scenarios (topics).
'Teacher, Topics, can edit, has availability and is available' => [
diff --git a/course/format/tests/output/local/state/state_test.php b/course/format/tests/output/local/state/state_test.php
index 8e073b83a62..a07b3f6f36b 100644
--- a/course/format/tests/output/local/state/state_test.php
+++ b/course/format/tests/output/local/state/state_test.php
@@ -151,7 +151,7 @@ class state_test extends \advanced_testcase {
*
* @return array
*/
- public function state_provider(): array {
+ public static function state_provider(): array {
return [
// COURSEFORMAT. Test behaviour depending on course formats.
'Single activity format' => [
diff --git a/course/format/tests/stateactions_test.php b/course/format/tests/stateactions_test.php
index 4fbce6c6863..4c73fa076d4 100644
--- a/course/format/tests/stateactions_test.php
+++ b/course/format/tests/stateactions_test.php
@@ -30,7 +30,7 @@ use stdClass;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @coversDefaultClass \core_courseformat\stateactions
*/
-class stateactions_test extends \advanced_testcase {
+final class stateactions_test extends \advanced_testcase {
/**
* Helper method to create an activity into a section and add it to the $sections and $activities arrays.
*
@@ -46,7 +46,6 @@ class stateactions_test extends \advanced_testcase {
int $section,
bool $visible = true
): int {
-
$activity = $this->getDataGenerator()->create_module(
$type,
['course' => $courseid],
@@ -199,7 +198,6 @@ class stateactions_test extends \advanced_testcase {
* @param array $params the ids, targetsection and targetcm to use as params
* @param array $expectedresults List of the course module names expected after calling the method.
* @param bool $expectedexception If this call will raise an exception.
-
*/
public function test_get_state(
string $format,
@@ -209,7 +207,6 @@ class stateactions_test extends \advanced_testcase {
array $expectedresults,
bool $expectedexception = false
): void {
-
$this->resetAfterTest();
// Create a course with 3 sections, 1 of them hidden.
@@ -269,29 +266,29 @@ class stateactions_test extends \advanced_testcase {
*
* @return array the testing scenarios
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
return array_merge(
- $this->course_state_provider('weeks'),
- $this->course_state_provider('topics'),
- $this->course_state_provider('social'),
- $this->section_state_provider('weeks', 'admin'),
- $this->section_state_provider('weeks', 'editingteacher'),
- $this->section_state_provider('weeks', 'student'),
- $this->section_state_provider('topics', 'admin'),
- $this->section_state_provider('topics', 'editingteacher'),
- $this->section_state_provider('topics', 'student'),
- $this->section_state_provider('social', 'admin'),
- $this->section_state_provider('social', 'editingteacher'),
- $this->section_state_provider('social', 'student'),
- $this->cm_state_provider('weeks', 'admin'),
- $this->cm_state_provider('weeks', 'editingteacher'),
- $this->cm_state_provider('weeks', 'student'),
- $this->cm_state_provider('topics', 'admin'),
- $this->cm_state_provider('topics', 'editingteacher'),
- $this->cm_state_provider('topics', 'student'),
- $this->cm_state_provider('social', 'admin'),
- $this->cm_state_provider('social', 'editingteacher'),
- $this->cm_state_provider('social', 'student'),
+ static::course_state_provider('weeks'),
+ static::course_state_provider('topics'),
+ static::course_state_provider('social'),
+ static::section_state_provider('weeks', 'admin'),
+ static::section_state_provider('weeks', 'editingteacher'),
+ static::section_state_provider('weeks', 'student'),
+ static::section_state_provider('topics', 'admin'),
+ static::section_state_provider('topics', 'editingteacher'),
+ static::section_state_provider('topics', 'student'),
+ static::section_state_provider('social', 'admin'),
+ static::section_state_provider('social', 'editingteacher'),
+ static::section_state_provider('social', 'student'),
+ static::cm_state_provider('weeks', 'admin'),
+ static::cm_state_provider('weeks', 'editingteacher'),
+ static::cm_state_provider('weeks', 'student'),
+ static::cm_state_provider('topics', 'admin'),
+ static::cm_state_provider('topics', 'editingteacher'),
+ static::cm_state_provider('topics', 'student'),
+ static::cm_state_provider('social', 'admin'),
+ static::cm_state_provider('social', 'editingteacher'),
+ static::cm_state_provider('social', 'student'),
);
}
@@ -301,7 +298,7 @@ class stateactions_test extends \advanced_testcase {
* @param string $format the course format
* @return array the testing scenarios
*/
- public function course_state_provider(string $format): array {
+ public static function course_state_provider(string $format): array {
$expectedexception = ($format === 'social');
return [
// Tests for course_state.
@@ -357,8 +354,7 @@ class stateactions_test extends \advanced_testcase {
* @param string $role the user role
* @return array the testing scenarios
*/
- public function section_state_provider(string $format, string $role): array {
-
+ public static function section_state_provider(string $format, string $role): array {
// Social format will raise an exception and debug messages because it does not
// use sections and it does not provide a renderer.
$expectedexception = ($format === 'social');
@@ -486,8 +482,7 @@ class stateactions_test extends \advanced_testcase {
* @param string $role the user role
* @return array the testing scenarios
*/
- public function cm_state_provider(string $format, string $role): array {
-
+ public static function cm_state_provider(string $format, string $role): array {
// All sections and cms that the user can access to.
$usersections = ['section0', 'section1', 'section2', 'section3'];
$usercms = ['cm0', 'cm1', 'cm2', 'cm3'];
@@ -862,7 +857,7 @@ class stateactions_test extends \advanced_testcase {
*
* @return array the testing scenarios
*/
- public function basic_role_provider() {
+ public static function basic_role_provider(): array {
return [
'editingteacher' => [
'role' => 'editingteacher',
@@ -973,7 +968,7 @@ class stateactions_test extends \advanced_testcase {
*
* @return array the testing scenarios
*/
- public function cm_duplicate_provider(): array {
+ public static function cm_duplicate_provider(): array {
return [
'valid cms without target section' => [
'targetsection' => '',
@@ -1299,7 +1294,7 @@ class stateactions_test extends \advanced_testcase {
*
* @return array the testing scenarios
*/
- public function section_move_after_provider(): array {
+ public static function section_move_after_provider(): array {
return [
'Move sections down' => [
'sectiontomove' => ['section2', 'section4'],
diff --git a/course/format/tests/stateupdates_test.php b/course/format/tests/stateupdates_test.php
index a5206b3ff7c..8831c4c64d1 100644
--- a/course/format/tests/stateupdates_test.php
+++ b/course/format/tests/stateupdates_test.php
@@ -81,7 +81,7 @@ class stateupdates_test extends \advanced_testcase {
*
* @return array testing scenarios
*/
- public function add_course_put_provider() {
+ public static function add_course_put_provider(): array {
return [
'Admin role' => [
'admin',
@@ -199,11 +199,11 @@ class stateupdates_test extends \advanced_testcase {
*
* @return array testing scenarios
*/
- public function add_section_provider(): array {
+ public static function add_section_provider(): array {
return array_merge(
- $this->add_section_provider_helper('put'),
- $this->add_section_provider_helper('create'),
- $this->add_section_provider_helper('remove'),
+ self::add_section_provider_helper('put'),
+ self::add_section_provider_helper('create'),
+ self::add_section_provider_helper('remove'),
);
}
@@ -213,7 +213,7 @@ class stateupdates_test extends \advanced_testcase {
* @param string $action the action to perform
* @return array testing scenarios
*/
- private function add_section_provider_helper(string $action): array {
+ private static function add_section_provider_helper(string $action): array {
// Delete does not depends on user permissions.
if ($action == 'remove') {
$studentsections = [0, 1, 2];
@@ -343,11 +343,11 @@ class stateupdates_test extends \advanced_testcase {
*
* @return array testing scenarios
*/
- public function add_cm_provider(): array {
+ public static function add_cm_provider(): array {
return array_merge(
- $this->add_cm_provider_helper('put'),
- $this->add_cm_provider_helper('create'),
- $this->add_cm_provider_helper('remove'),
+ self::add_cm_provider_helper('put'),
+ self::add_cm_provider_helper('create'),
+ self::add_cm_provider_helper('remove'),
);
}
@@ -357,7 +357,7 @@ class stateupdates_test extends \advanced_testcase {
* @param string $action the action to perform
* @return array testing scenarios
*/
- private function add_cm_provider_helper(string $action): array {
+ private static function add_cm_provider_helper(string $action): array {
// Delete does not depends on user permissions.
if ($action == 'remove') {
$studentcms = [0, 1, 2, 3];
diff --git a/course/format/topics/tests/courseformat/stateactions_test.php b/course/format/topics/tests/courseformat/stateactions_test.php
index 6c1d936b407..72e297908ab 100644
--- a/course/format/topics/tests/courseformat/stateactions_test.php
+++ b/course/format/topics/tests/courseformat/stateactions_test.php
@@ -191,7 +191,7 @@ class stateactions_test extends \advanced_testcase {
*
* @return array the testing scenarios
*/
- public function basic_role_provider(): array {
+ public static function basic_role_provider(): array {
return [
'admin' => [
'role' => 'admin',
diff --git a/course/tests/category_test.php b/course/tests/category_test.php
index b6eba967d4b..9c1f45d20f4 100644
--- a/course/tests/category_test.php
+++ b/course/tests/category_test.php
@@ -1289,7 +1289,7 @@ class category_test extends \advanced_testcase {
*
* @return array
*/
- public function get_nearest_editable_subcategory_provider(): array {
+ public static function get_nearest_editable_subcategory_provider(): array {
return [
'Hidden main category for manager. Checking create and manage' => [
0,
diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php
index 1b66e9dda1c..43cb5d8b481 100644
--- a/course/tests/courselib_test.php
+++ b/course/tests/courselib_test.php
@@ -638,7 +638,7 @@ class courselib_test extends advanced_testcase {
*
* @return array An array of arrays contain test data
*/
- public function provider_course_delete_module() {
+ public static function provider_course_delete_module(): array {
$data = array();
$data['assign'] = array('assign', array('duedate' => time()));
@@ -811,7 +811,7 @@ class courselib_test extends advanced_testcase {
/**
* Relative dates mode settings provider for course creation.
*/
- public function create_course_relative_dates_provider() {
+ public static function create_course_relative_dates_provider(): array {
return [
[0, 0, 0],
[0, 1, 0],
@@ -3560,7 +3560,7 @@ class courselib_test extends advanced_testcase {
*
* @return array
*/
- public function course_enddate_provider() {
+ public static function course_enddate_provider(): array {
// Each provided example contains startdate, enddate and the expected exception error code if there is any.
return [
[
@@ -3642,7 +3642,7 @@ class courselib_test extends advanced_testcase {
*
* @return array
*/
- public function course_dates_reset_provider() {
+ public static function course_dates_reset_provider(): array {
// Each example contains the following:
// - course startdate
@@ -4543,7 +4543,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_classify_courses_for_timeline test.
*/
- public function get_course_classify_courses_for_timeline_test_cases() {
+ public static function get_course_classify_courses_for_timeline_test_cases(): array {
$now = time();
$day = 86400;
@@ -4654,7 +4654,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_classify_courses_for_timeline function.
*
- * @dataProvider get_course_classify_courses_for_timeline_test_cases()
+ * @dataProvider get_course_classify_courses_for_timeline_test_cases
* @param array $coursesdata Courses to create
* @param array $expected Expected test results.
*/
@@ -4696,7 +4696,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_get_enrolled_courses_for_logged_in_user tests.
*/
- public function get_course_get_enrolled_courses_for_logged_in_user_test_cases() {
+ public static function get_course_get_enrolled_courses_for_logged_in_user_test_cases(): array {
$buildexpectedresult = function($limit, $offset) {
$result = [];
for ($i = $offset; $i < $offset + $limit; $i++) {
@@ -4784,7 +4784,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_get_enrolled_courses_for_logged_in_user function.
*
- * @dataProvider get_course_get_enrolled_courses_for_logged_in_user_test_cases()
+ * @dataProvider get_course_get_enrolled_courses_for_logged_in_user_test_cases
* @param int $dbquerylimit Number of records to load per DB request
* @param int $totalcourses Number of courses to create
* @param int $limit Maximum number of results to get.
@@ -4832,7 +4832,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_filter_courses_by_timeline_classification tests.
*/
- public function get_course_filter_courses_by_timeline_classification_test_cases() {
+ public static function get_course_filter_courses_by_timeline_classification_test_cases(): array {
$now = time();
$day = 86400;
@@ -5082,7 +5082,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_filter_courses_by_timeline_classification function.
*
- * @dataProvider get_course_filter_courses_by_timeline_classification_test_cases()
+ * @dataProvider get_course_filter_courses_by_timeline_classification_test_cases
* @param array $coursedata Course test data to create.
* @param string $classification Timeline classification.
* @param int $limit Maximum number of results to return.
@@ -5131,7 +5131,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_filter_courses_by_timeline_classification tests.
*/
- public function get_course_filter_courses_by_customfield_test_cases() {
+ public static function get_course_filter_courses_by_customfield_test_cases(): array {
global $CFG;
require_once($CFG->dirroot.'/blocks/myoverview/lib.php');
$coursedata = [
@@ -5301,7 +5301,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_filter_courses_by_customfield function.
*
- * @dataProvider get_course_filter_courses_by_customfield_test_cases()
+ * @dataProvider get_course_filter_courses_by_customfield_test_cases
* @param array $coursedata Course test data to create.
* @param string $customfield Shortname of the customfield.
* @param string $customfieldvalue the value to filter by.
@@ -5387,7 +5387,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_filter_courses_by_timeline_classification w/ hidden courses tests.
*/
- public function get_course_filter_courses_by_timeline_classification_hidden_courses_test_cases() {
+ public static function get_course_filter_courses_by_timeline_classification_hidden_courses_test_cases(): array {
$now = time();
$day = 86400;
@@ -5546,7 +5546,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_filter_courses_by_timeline_classification function hidden courses.
*
- * @dataProvider get_course_filter_courses_by_timeline_classification_hidden_courses_test_cases()
+ * @dataProvider get_course_filter_courses_by_timeline_classification_hidden_courses_test_cases
* @param array $coursedata Course test data to create.
* @param string $classification Timeline classification.
* @param int $limit Maximum number of results to return.
@@ -5756,7 +5756,7 @@ class courselib_test extends advanced_testcase {
*
* @return array
*/
- function course_get_recent_courses_sort_validation_provider() {
+ public static function course_get_recent_courses_sort_validation_provider(): array {
return [
'Invalid sort format (SQL injection attempt)' =>
[
@@ -5830,7 +5830,7 @@ class courselib_test extends advanced_testcase {
/**
* Test cases for the course_get_course_dates_for_user_ids tests.
*/
- public function get_course_get_course_dates_for_user_ids_test_cases() {
+ public static function get_course_get_course_dates_for_user_ids_test_cases(): array {
$now = time();
$pastcoursestart = $now - 100;
$futurecoursestart = $now + 100;
@@ -7044,7 +7044,7 @@ class courselib_test extends advanced_testcase {
/**
* Test the course_get_course_dates_for_user_ids function.
*
- * @dataProvider get_course_get_course_dates_for_user_ids_test_cases()
+ * @dataProvider get_course_get_course_dates_for_user_ids_test_cases
* @param bool $relativedatemode Set the course to relative dates mode
* @param int $coursestart Course start date
* @param int $usercount Number of users to create
@@ -7137,7 +7137,7 @@ class courselib_test extends advanced_testcase {
*
* @return array An array of arrays contain test data
*/
- public function provider_course_modules_pending_deletion() {
+ public static function provider_course_modules_pending_deletion(): array {
return [
'Non-gradable activity, check all' => [['forum'], 0, false, true],
'Gradable activity, check all' => [['assign'], 0, false, true],
diff --git a/course/tests/externallib_test.php b/course/tests/externallib_test.php
index 881a3ec0b9b..a5dd6d58285 100644
--- a/course/tests/externallib_test.php
+++ b/course/tests/externallib_test.php
@@ -3819,7 +3819,7 @@ final class externallib_test extends externallib_advanced_testcase {
/**
* Test the get_enrolled_courses_by_timeline_classification function.
*
- * @dataProvider get_get_enrolled_courses_by_timeline_classification_test_cases()
+ * @dataProvider get_get_enrolled_courses_by_timeline_classification_test_cases
* @param array $coursedata Courses to create
* @param string $classification Timeline classification
* @param int $limit Maximum number of results
diff --git a/course/tests/reportbuilder/datasource/courses_test.php b/course/tests/reportbuilder/datasource/courses_test.php
index 46353b23b96..b6c903ce52b 100644
--- a/course/tests/reportbuilder/datasource/courses_test.php
+++ b/course/tests/reportbuilder/datasource/courses_test.php
@@ -228,7 +228,7 @@ class courses_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
- public function datasource_filters_provider(): array {
+ public static function datasource_filters_provider(): array {
return [
// Category.
'Filter category name' => ['course_category:text', [
diff --git a/course/tests/targets_test.php b/course/tests/targets_test.php
index ec4e9f8f022..2363a83696a 100644
--- a/course/tests/targets_test.php
+++ b/course/tests/targets_test.php
@@ -40,7 +40,7 @@ class targets_test extends \advanced_testcase {
*
* @return array
*/
- public function analysable_provider() {
+ public static function analysable_provider(): array {
$now = new \DateTime("now", \core_date::get_server_timezone_object());
$year = $now->format('Y');
@@ -153,7 +153,7 @@ class targets_test extends \advanced_testcase {
*
* @return array
*/
- public function sample_provider() {
+ public static function sample_provider(): array {
$now = time();
return [
'enrolmentendbeforecourse' => [
@@ -204,7 +204,7 @@ class targets_test extends \advanced_testcase {
*
* @return array
*/
- public function active_during_analysis_time_provider() {
+ public static function active_during_analysis_time_provider(): array {
$now = time();
return [
diff --git a/customfield/field/date/tests/plugin_test.php b/customfield/field/date/tests/plugin_test.php
index 2a19f0e7020..d15e9750403 100644
--- a/customfield/field/date/tests/plugin_test.php
+++ b/customfield/field/date/tests/plugin_test.php
@@ -170,7 +170,7 @@ class plugin_test extends \advanced_testcase {
*
* @return array
*/
- public function parse_value_provider(): array {
+ public static function parse_value_provider(): array {
return [
// Valid times.
['2019-10-01', strtotime('2019-10-01')],
diff --git a/enrol/ldap/tests/ldap_test.php b/enrol/ldap/tests/ldap_test.php
index 55035fad01f..f65c58c3085 100644
--- a/enrol/ldap/tests/ldap_test.php
+++ b/enrol/ldap/tests/ldap_test.php
@@ -45,7 +45,7 @@ class ldap_test extends \advanced_testcase {
*
* @return array[]
*/
- public function enrol_ldap_provider() {
+ public static function enrol_ldap_provider(): array {
$pagesizes = [1, 3, 5, 1000];
$subcontexts = [0, 1];
$combinations = [];
@@ -524,7 +524,7 @@ class ldap_test extends \advanced_testcase {
*
* @return array of testcases.
*/
- public function objectclass_fetch_provider() {
+ public static function objectclass_fetch_provider(): array {
return array(
// This is the list of values from ldap_getdefaults() normalised.
'edir' => array(
diff --git a/enrol/lti/tests/helper_test.php b/enrol/lti/tests/helper_test.php
index 36cb89f59f2..de058c763c2 100644
--- a/enrol/lti/tests/helper_test.php
+++ b/enrol/lti/tests/helper_test.php
@@ -405,7 +405,7 @@ class helper_test extends \advanced_testcase {
/**
* Data provider for the set_xpath test.
*/
- public function set_xpath_provider() {
+ public static function set_xpath_provider(): array {
return [
"Correct structure" => [
"parameters" => [
diff --git a/enrol/lti/tests/local/ltiadvantage/entity/ags_info_test.php b/enrol/lti/tests/local/ltiadvantage/entity/ags_info_test.php
index 538d7a4a031..ea3c58dd072 100644
--- a/enrol/lti/tests/local/ltiadvantage/entity/ags_info_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/entity/ags_info_test.php
@@ -58,7 +58,7 @@ class ags_info_test extends \advanced_testcase {
* Data provider for testing object instantiation.
* @return array the data for testing.
*/
- public function instantiation_data_provider(): array {
+ public static function instantiation_data_provider(): array {
return [
'Both lineitems and lineitem URL provided with full list of valid scopes' => [
'args' => [
diff --git a/enrol/lti/tests/local/ltiadvantage/entity/application_registration_test.php b/enrol/lti/tests/local/ltiadvantage/entity/application_registration_test.php
index 727c2f2a001..d01895afc9e 100644
--- a/enrol/lti/tests/local/ltiadvantage/entity/application_registration_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/entity/application_registration_test.php
@@ -59,7 +59,7 @@ class application_registration_test extends \advanced_testcase {
*
* @return array the data for testing.
*/
- public function creation_data_provider(): array {
+ public static function creation_data_provider(): array {
return [
'Valid, only required args provided' => [
'args' => [
@@ -203,7 +203,7 @@ class application_registration_test extends \advanced_testcase {
*
* @return array the test case data.
*/
- public function create_draft_data_provider(): array {
+ public static function create_draft_data_provider(): array {
return [
'Valid, new draft' => [
'args' => [
@@ -268,7 +268,7 @@ class application_registration_test extends \advanced_testcase {
*
* @return array the array of test data.
*/
- public function add_tool_deployment_data_provider(): array {
+ public static function add_tool_deployment_data_provider(): array {
return [
'Valid, contains id on registration and valid deployment data provided' => [
'args' => [
diff --git a/enrol/lti/tests/local/ltiadvantage/entity/context_test.php b/enrol/lti/tests/local/ltiadvantage/entity/context_test.php
index 0898222013d..a8c9f217d1f 100644
--- a/enrol/lti/tests/local/ltiadvantage/entity/context_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/entity/context_test.php
@@ -52,7 +52,7 @@ class context_test extends \advanced_testcase {
* Data provider for testing object instantiation.
* @return array[] the data for testing.
*/
- public function instantiation_data_provider(): array {
+ public static function instantiation_data_provider(): array {
return [
'Creation of a course section context' => [
'args' => [
diff --git a/enrol/lti/tests/local/ltiadvantage/entity/deployment_test.php b/enrol/lti/tests/local/ltiadvantage/entity/deployment_test.php
index 4adb64b18aa..54c65747be4 100644
--- a/enrol/lti/tests/local/ltiadvantage/entity/deployment_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/entity/deployment_test.php
@@ -53,7 +53,7 @@ class deployment_test extends \advanced_testcase {
* Data provider for testing object instantiation.
* @return array the data for testing.
*/
- public function instantiation_data_provider(): array {
+ public static function instantiation_data_provider(): array {
return [
'Valid deployment creation, no id or legacy consumer key' => [
'args' => [
diff --git a/enrol/lti/tests/local/ltiadvantage/entity/migration_claim_test.php b/enrol/lti/tests/local/ltiadvantage/entity/migration_claim_test.php
index 4fd9fd6e295..2c51336ac6a 100644
--- a/enrol/lti/tests/local/ltiadvantage/entity/migration_claim_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/entity/migration_claim_test.php
@@ -55,27 +55,55 @@ class migration_claim_test extends \advanced_testcase {
* @param string $clientid string id of the client.
* @param string $exp expiry time.
* @param string $nonce nonce.
- * @param legacy_consumer_repository $legacyconsumerrepo legacy consumer repo instance.
+ * @param bool $stublegacyconsumerrepo Whether the legacy consumer repo is a stub
* @param array $expected array containing expectation data.
* @covers ::__construct
*/
- public function test_migration_claim(array $migrationclaimdata, string $deploymentid, string $platform,
- string $clientid, string $exp, string $nonce, legacy_consumer_repository $legacyconsumerrepo,
- array $expected): void {
+ public function test_migration_claim(
+ array $migrationclaimdata,
+ string $deploymentid,
+ string $platform,
+ string $clientid,
+ string $exp,
+ string $nonce,
+ bool $stublegacyconsumerrepo,
+ array $expected,
+ ): void {
+ if ($stublegacyconsumerrepo) {
+ $legacyconsumerrepo = $this->get_stub_legacy_consumer_repo();
+ } else {
+ $legacyconsumerrepo = new legacy_consumer_repository();
+ }
if (!empty($expected['exception'])) {
$this->expectException($expected['exception']);
$this->expectExceptionMessage($expected['exceptionmessage']);
- new migration_claim($migrationclaimdata, $deploymentid, $platform, $clientid, $exp, $nonce,
- $legacyconsumerrepo);
+ new migration_claim(
+ $migrationclaimdata,
+ $deploymentid,
+ $platform,
+ $clientid,
+ $exp,
+ $nonce,
+ $legacyconsumerrepo,
+ );
} else {
- $migrationclaim = new migration_claim($migrationclaimdata, $deploymentid, $platform, $clientid, $exp,
- $nonce, $legacyconsumerrepo);
+ $migrationclaim = new migration_claim(
+ $migrationclaimdata,
+ $deploymentid,
+ $platform,
+ $clientid,
+ $exp,
+ $nonce,
+ $legacyconsumerrepo,
+ );
$this->assertInstanceOf(migration_claim::class, $migrationclaim);
$this->assertEquals($expected['user_id'], $migrationclaim->get_user_id());
$this->assertEquals($expected['context_id'], $migrationclaim->get_context_id());
- $this->assertEquals($expected['tool_consumer_instance_guid'],
- $migrationclaim->get_tool_consumer_instance_guid());
+ $this->assertEquals(
+ $expected['tool_consumer_instance_guid'],
+ $migrationclaim->get_tool_consumer_instance_guid(),
+ );
$this->assertEquals($expected['resource_link_id'], $migrationclaim->get_resource_link_id());
}
}
@@ -85,7 +113,7 @@ class migration_claim_test extends \advanced_testcase {
*
* @return array[] the test case data.
*/
- public function migration_claim_provider(): array {
+ public static function migration_claim_provider(): array {
// Note: See https://www.imsglobal.org/spec/lti/v1p3/migr#lti-1-1-migration-claim for details regarding the
// correct generation of oauth_consumer_key_sign signature.
return [
@@ -99,7 +127,7 @@ class migration_claim_test extends \advanced_testcase {
'clientid' => 'a1b2c3d4',
'exp' => '1622612930',
'nonce' => 'j45j2j5nnjn24544',
- new legacy_consumer_repository(),
+ 'stublegacyconsumerrepo' => false,
'expected' => [
'exception' => \coding_exception::class,
'exceptionmessage' => "Missing 'oauth_consumer_key' property in lti1p1 migration claim."
@@ -115,7 +143,7 @@ class migration_claim_test extends \advanced_testcase {
'clientid' => 'a1b2c3d4',
'exp' => '1622612930',
'nonce' => 'j45j2j5nnjn24544',
- new legacy_consumer_repository(),
+ 'stublegacyconsumerrepo' => false,
'expected' => [
'exception' => \coding_exception::class,
'exceptionmessage' => "Missing 'oauth_consumer_key_sign' property in lti1p1 migration claim."
@@ -131,7 +159,7 @@ class migration_claim_test extends \advanced_testcase {
'clientid' => 'a1b2c3d4',
'exp' => '1622612930',
'nonce' => 'j45j2j5nnjn24544',
- new legacy_consumer_repository(),
+ 'stublegacyconsumerrepo' => false,
'expected' => [
'exception' => \coding_exception::class,
'exceptionmessage' => "Invalid 'oauth_consumer_key_sign' signature in lti1p1 claim."
@@ -153,7 +181,7 @@ class migration_claim_test extends \advanced_testcase {
'clientid' => 'a1b2c3d4',
'exp' => '1622612930',
'nonce' => 'j45j2j5nnjn24544',
- $this->get_stub_legacy_consumer_repo(),
+ 'stublegacyconsumerrepo' => true,
'expected' => [
'user_id' => null,
'context_id' => null,
@@ -181,7 +209,7 @@ class migration_claim_test extends \advanced_testcase {
'clientid' => 'a1b2c3d4',
'exp' => '1622612930',
'nonce' => 'j45j2j5nnjn24544',
- $this->get_stub_legacy_consumer_repo(),
+ 'stublegacyconsumerrepo' => true,
'expected' => [
'user_id' => '24',
'context_id' => 'd345b',
diff --git a/enrol/lti/tests/local/ltiadvantage/entity/nrps_info_test.php b/enrol/lti/tests/local/ltiadvantage/entity/nrps_info_test.php
index df0b436a5ac..fd560dffac6 100644
--- a/enrol/lti/tests/local/ltiadvantage/entity/nrps_info_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/entity/nrps_info_test.php
@@ -52,7 +52,7 @@ class nrps_info_test extends \advanced_testcase {
* Data provider for testing object instantiation.
* @return array the data for testing.
*/
- public function instantiation_data_provider(): array {
+ public static function instantiation_data_provider(): array {
return [
'Valid creation' => [
'args' => [
diff --git a/enrol/lti/tests/local/ltiadvantage/entity/resource_link_test.php b/enrol/lti/tests/local/ltiadvantage/entity/resource_link_test.php
index e1726f3d0c6..a9f8d58e694 100644
--- a/enrol/lti/tests/local/ltiadvantage/entity/resource_link_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/entity/resource_link_test.php
@@ -54,7 +54,7 @@ class resource_link_test extends \advanced_testcase {
* Data provider for testing object instantiation.
* @return array the data for testing.
*/
- public function instantiation_data_provider(): array {
+ public static function instantiation_data_provider(): array {
return [
'Valid creation, no context or id provided' => [
'args' => [
@@ -140,7 +140,7 @@ class resource_link_test extends \advanced_testcase {
*
* @return array the array of test case data.
*/
- public function add_grade_service_provider(): array {
+ public static function add_grade_service_provider(): array {
return [
'Valid, both URLs, some scopes' => [
'args' => [
diff --git a/enrol/lti/tests/local/ltiadvantage/lti_advantage_testcase.php b/enrol/lti/tests/local/ltiadvantage/lti_advantage_testcase.php
index 9915064236c..215d620f0b6 100644
--- a/enrol/lti/tests/local/ltiadvantage/lti_advantage_testcase.php
+++ b/enrol/lti/tests/local/ltiadvantage/lti_advantage_testcase.php
@@ -100,9 +100,11 @@ abstract class lti_advantage_testcase extends \advanced_testcase {
* @param string $role the LTI role to include in the user data.
* @return array the users list.
*/
- protected function get_mock_launch_users_with_ids(array $ids, bool $includepicture = false,
- string $role = 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor'): array {
-
+ protected static function get_mock_launch_users_with_ids(
+ array $ids,
+ bool $includepicture = false,
+ string $role = 'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
+ ): array {
$users = [];
foreach ($ids as $id) {
$user = [
diff --git a/enrol/lti/tests/local/ltiadvantage/repository/application_registration_repository_test.php b/enrol/lti/tests/local/ltiadvantage/repository/application_registration_repository_test.php
index 1db47aa23aa..f4f344622df 100644
--- a/enrol/lti/tests/local/ltiadvantage/repository/application_registration_repository_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/repository/application_registration_repository_test.php
@@ -135,7 +135,7 @@ class application_registration_repository_test extends \advanced_testcase {
*
* @return array the array of test data.
*/
- public function save_data_provider(): array {
+ public static function save_data_provider(): array {
return [
'minimal draft' => [
'registrationdata' => [
diff --git a/enrol/lti/tests/local/ltiadvantage/service/tool_launch_service_test.php b/enrol/lti/tests/local/ltiadvantage/service/tool_launch_service_test.php
index 16be61fcfd8..5ab67177349 100644
--- a/enrol/lti/tests/local/ltiadvantage/service/tool_launch_service_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/service/tool_launch_service_test.php
@@ -123,12 +123,12 @@ class tool_launch_service_test extends \lti_advantage_testcase {
*
* @return array the test case data.
*/
- public function user_launch_provider(): array {
+ public static function user_launch_provider(): array {
return [
'New tool: no legacy data, no migration claim sent' => [
'legacy_data' => null,
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => null,
],
'expected' => [
@@ -144,7 +144,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1'])[0],
'launch_migration_claim' => [
'consumer_key' => 'CONSUMER_1',
'signing_secret' => 'toolsecret1',
@@ -167,7 +167,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => [
'consumer_key' => 'CONSUMER_1',
'signing_secret' => 'toolsecret2',
@@ -189,7 +189,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => null,
],
'expected' => [
@@ -205,7 +205,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => [
'consumer_key' => 'CONSUMER_1',
'signing_secret' => 'secret-not-mapped-to-consumer',
@@ -229,7 +229,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => [
'consumer_key' => 'CONSUMER_1',
'user_id' => 'user-id-123',
@@ -252,7 +252,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
]
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => [
'user_id' => 'user-id-123',
'context_id' => 'd345b',
@@ -277,7 +277,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
[$course, $modresource] = $this->create_test_environment();
$instructoruser = $this->getDataGenerator()->create_user();
$launchservice = $this->get_tool_launch_service();
- $mockuser = $this->get_mock_launch_users_with_ids(['1p3_1'])[0];
+ $mockuser = self::get_mock_launch_users_with_ids(['1p3_1'])[0];
$mocklaunch = $this->get_mock_launch($modresource, $mockuser, null, null, false, null, []);
$this->expectException(\moodle_exception::class);
@@ -295,7 +295,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
[$course, $modresource] = $this->create_test_environment();
$instructoruser = $this->getDataGenerator()->create_user();
$launchservice = $this->get_tool_launch_service();
- $mockuser = $this->get_mock_launch_users_with_ids(['1p3_1'])[0];
+ $mockuser = self::get_mock_launch_users_with_ids(['1p3_1'])[0];
$mocklaunch = $this->get_mock_launch($modresource, $mockuser, null, null, false, null, ['id' => 999999]);
$this->expectException(\moodle_exception::class);
@@ -327,7 +327,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
// Call the service.
$launchservice = $this->get_tool_launch_service();
- $mockuser = $this->get_mock_launch_users_with_ids(['1p3_1'])[0];
+ $mockuser = self::get_mock_launch_users_with_ids(['1p3_1'])[0];
$mocklaunch = $this->get_mock_launch($modresource, $mockuser);
$this->expectException(\moodle_exception::class);
@@ -360,7 +360,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
// Call the service.
$launchservice = $this->get_tool_launch_service();
- $mockuser = $this->get_mock_launch_users_with_ids(['1p3_1'])[0];
+ $mockuser = self::get_mock_launch_users_with_ids(['1p3_1'])[0];
$mocklaunch = $this->get_mock_launch($modresource, $mockuser);
$this->expectException(\moodle_exception::class);
@@ -382,18 +382,18 @@ class tool_launch_service_test extends \lti_advantage_testcase {
$instructor2user = $this->getDataGenerator()->create_user();
$adminuser = $this->getDataGenerator()->create_user();
$learneruser = $this->getDataGenerator()->create_user();
- $mockinstructoruser = $this->get_mock_launch_users_with_ids(['1'])[0];
- $mockadminuser = $this->get_mock_launch_users_with_ids(
+ $mockinstructoruser = self::get_mock_launch_users_with_ids(['1'])[0];
+ $mockadminuser = self::get_mock_launch_users_with_ids(
['2'],
false,
'http://purl.imsglobal.org/vocab/lis/v2/system/person#Administrator'
)[0];
- $mocklearneruser = $this->get_mock_launch_users_with_ids(
+ $mocklearneruser = self::get_mock_launch_users_with_ids(
['3'],
false,
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
)[0];
- $mockinstructor2user = $this->get_mock_launch_users_with_ids(
+ $mockinstructor2user = self::get_mock_launch_users_with_ids(
['3'],
false,
'Instructor' // Using the legacy (deprecated in 1.3) simple name.
@@ -433,7 +433,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
$this->resetAfterTest();
[$course, $modresource] = $this->create_test_environment();
$user = $this->getDataGenerator()->create_user();
- $mockinstructoruser = $this->get_mock_launch_users_with_ids(['1'])[0];
+ $mockinstructoruser = self::get_mock_launch_users_with_ids(['1'])[0];
$launchservice = $this->get_tool_launch_service();
$userrepo = new user_repository();
@@ -481,7 +481,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
[$course, $modresource] = $this->create_test_environment(true, true, false,
\enrol_lti\helper::MEMBER_SYNC_ENROL_NEW, false, false, time() + DAYSECS);
$instructoruser = $this->getDataGenerator()->create_user();
- $mockinstructoruser = $this->get_mock_launch_users_with_ids(['1'])[0];
+ $mockinstructoruser = self::get_mock_launch_users_with_ids(['1'])[0];
$mockinstructorlaunch = $this->get_mock_launch($modresource, $mockinstructoruser);
$launchservice = $this->get_tool_launch_service();
@@ -499,8 +499,8 @@ class tool_launch_service_test extends \lti_advantage_testcase {
[$course, $modresource] = $this->create_test_environment();
$instructoruser = $this->getDataGenerator()->create_user();
$learneruser = $this->getDataGenerator()->create_user();
- $mockinstructoruser = $this->get_mock_launch_users_with_ids(['1'])[0];
- $mocklearneruser = $this->get_mock_launch_users_with_ids(['1'], false, '')[0];
+ $mockinstructoruser = self::get_mock_launch_users_with_ids(['1'])[0];
+ $mocklearneruser = self::get_mock_launch_users_with_ids(['1'], false, '')[0];
$mockinstructorlaunch = $this->get_mock_launch($modresource, $mockinstructoruser, null, null, false, null, [
'id' => $modresource->uuid,
'forcedembed' => true
@@ -533,7 +533,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
$this->resetAfterTest();
[$course, $modresource] = $this->create_test_environment();
$instructoruser = $this->getDataGenerator()->create_user();
- $mockinstructoruser = $this->get_mock_launch_users_with_ids(['1'])[0];
+ $mockinstructoruser = self::get_mock_launch_users_with_ids(['1'])[0];
$mockinstructorlaunch = $this->get_mock_launch($modresource, $mockinstructoruser, null, null, false, null, [
'id' => $modresource->uuid,
], $aud);
@@ -554,7 +554,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
*
* @return array the test case data
*/
- public function aud_data_provider(): array {
+ public static function aud_data_provider(): array {
return [
'valid, array having multiple entries with the first one being clientid' => [
'aud' => ['123', 'something else', 'blah'],
@@ -622,7 +622,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
$this->resetAfterTest();
[$course, $modresource] = $this->create_test_environment();
$instructoruser = $this->getDataGenerator()->create_user();
- $mockinstructoruser = $this->get_mock_launch_users_with_ids(['1'])[0];
+ $mockinstructoruser = self::get_mock_launch_users_with_ids(['1'])[0];
$userrepo = new user_repository();
$resourcelinkrepo = new resource_link_repository();
$launchservice = $this->get_tool_launch_service();
@@ -662,7 +662,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
*
* @return array the array of test case data.
*/
- public function ags_claim_provider(): array {
+ public static function ags_claim_provider(): array {
return [
'Coupled line item with score post only, no change to scopes on subsequent launch' => [
'agsclaim1' => [
diff --git a/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php b/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php
index eccca4c6009..3518a771a27 100644
--- a/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php
@@ -73,8 +73,15 @@ class sync_members_test extends \lti_advantage_testcase {
* @return array the array of users.
* @throws \Exception if the legacyuserids array doesn't contain the correct number of ids.
*/
- protected function get_mock_members_with_ids(array $userids, ?array $legacyuserids = null, $names = true,
- $emails = true, bool $linklevel = true, bool $picture = false, array $roles = []): array {
+ protected static function get_mock_members_with_ids(
+ array $userids,
+ ?array $legacyuserids = null,
+ $names = true,
+ $emails = true,
+ bool $linklevel = true,
+ bool $picture = false,
+ array $roles = [],
+ ): array {
if (!is_null($legacyuserids) && count($legacyuserids) != count($userids)) {
throw new \Exception('legacyuserids must contain the same number of ids as $userids.');
@@ -88,7 +95,7 @@ class sync_members_test extends \lti_advantage_testcase {
foreach ($userids as $userid) {
$user = ['user_id' => (string) $userid, 'roles' => $roles];
if ($picture) {
- $user['picture'] = $this->getExternalTestFileUrl('/test.jpg', false);
+ $user['picture'] = static::getExternalTestFileUrl('/test.jpg', false);
}
if ($names) {
$user['given_name'] = 'Firstname' . $userid;
@@ -137,7 +144,7 @@ class sync_members_test extends \lti_advantage_testcase {
}
}
} else {
- return $this->get_mock_members_with_ids(range(1, 2));
+ return self::get_mock_members_with_ids(range(1, 2));
}
}));
return $mocktask;
@@ -161,7 +168,7 @@ class sync_members_test extends \lti_advantage_testcase {
$mocktask->expects($this->any())
->method('get_context_level_members')
->will($this->returnCallback(function() {
- return $this->get_mock_members_with_ids(range(1, 3), null, true, true, false);
+ return self::get_mock_members_with_ids(range(1, 3), null, true, true, false);
}));;
return $mocktask;
}
@@ -229,7 +236,7 @@ class sync_members_test extends \lti_advantage_testcase {
[$course, $resource] = $this->create_test_environment();
// Launch the tool for a user.
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids(['1'])[0]);
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids(['1'])[0]);
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice = $this->get_tool_launch_service();
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
@@ -261,15 +268,15 @@ class sync_members_test extends \lti_advantage_testcase {
// Launch twice - once from each resource link in the platform.
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids(['1'])[0], '123');
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids(['1'])[0], '123');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids(['1'])[0], '456');
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids(['1'])[0], '456');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
// Now, grab the resource links.
$rlrepo = new resource_link_repository();
$reslinks = $rlrepo->find_by_resource($resource->id);
- $mockmembers = $this->get_mock_members_with_ids(range(1, 10));
+ $mockmembers = self::get_mock_members_with_ids(range(1, 10));
$mockusers1 = array_slice($mockmembers, 0, 6);
$mockusers2 = array_slice($mockmembers, 6);
$resourcelinks = [
@@ -305,13 +312,13 @@ class sync_members_test extends \lti_advantage_testcase {
[$course, $resource] = $this->create_test_environment();
// Launch the tool for a user.
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids(['1'])[0]);
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids(['1'])[0]);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
// Sync members.
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(['1'], null, true, true, true, true));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(['1'], null, true, true, true, true));
ob_start();
$task->execute();
ob_end_clean();
@@ -336,7 +343,7 @@ class sync_members_test extends \lti_advantage_testcase {
[$course, $resource] = $this->create_test_environment();
// Launch the tool for a user.
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids(['1'])[0]);
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids(['1'])[0]);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
@@ -365,13 +372,13 @@ class sync_members_test extends \lti_advantage_testcase {
$userrepo = new user_repository();
// Launch the tool for a user.
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids(['1'])[0]);
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids(['1'])[0]);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
// Sync members.
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(range(1, 5), null, false, false));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(range(1, 5), null, false, false));
ob_start();
$task->execute();
@@ -398,7 +405,7 @@ class sync_members_test extends \lti_advantage_testcase {
}
// Sync again, this time with user data included.
- $mockmembers = $this->get_mock_members_with_ids(range(1, 5));
+ $mockmembers = self::get_mock_members_with_ids(range(1, 5));
$task = $this->get_mock_task_with_users($mockmembers);
ob_start();
@@ -429,14 +436,14 @@ class sync_members_test extends \lti_advantage_testcase {
[$course, $resource] = $this->create_test_environment(true, true, false);
// Launch the tool for a user.
- $mockuser = $this->get_mock_launch_users_with_ids(['1'])[0];
+ $mockuser = self::get_mock_launch_users_with_ids(['1'])[0];
$mocklaunch = $this->get_mock_launch($resource, $mockuser);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
// Sync members.
- $task = $this->get_mock_task_with_users($this->get_mock_launch_users_with_ids(range(1, 4)));
+ $task = $this->get_mock_task_with_users(self::get_mock_launch_users_with_ids(range(1, 4)));
ob_start();
$task->execute();
ob_end_clean();
@@ -461,14 +468,14 @@ class sync_members_test extends \lti_advantage_testcase {
$userrepo = new user_repository();
// Launch the tool for a user.
- $mockuser = $this->get_mock_launch_users_with_ids(['1'])[0];
+ $mockuser = self::get_mock_launch_users_with_ids(['1'])[0];
$mocklaunch = $this->get_mock_launch($resource, $mockuser);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
// Sync members.
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(range(1, 3)));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(range(1, 3)));
ob_start();
$task->execute();
@@ -481,7 +488,7 @@ class sync_members_test extends \lti_advantage_testcase {
// Now, simulate a subsequent sync in which 1 existing user maintains access,
// 2 existing users are unenrolled and 3 new users are enrolled.
- $task2 = $this->get_mock_task_with_users($this->get_mock_members_with_ids(['1', '4', '5', '6']));
+ $task2 = $this->get_mock_task_with_users(self::get_mock_members_with_ids(['1', '4', '5', '6']));
ob_start();
$task2->execute();
ob_end_clean();
@@ -509,14 +516,14 @@ class sync_members_test extends \lti_advantage_testcase {
$userrepo = new user_repository();
// Launch the tool for a user.
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids([1])[0]);
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids([1])[0]);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
$this->assertCount(1, $userrepo->find_by_resource($resource->id));
// Sync members using a payload which doesn't include the original launch user (User id = 1).
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(range(2, 3)));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(range(2, 3)));
ob_start();
$task->execute();
@@ -538,14 +545,14 @@ class sync_members_test extends \lti_advantage_testcase {
$userrepo = new user_repository();
// Launch the tool for a user.
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids([1])[0]);
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids([1])[0]);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
$this->assertCount(1, $userrepo->find_by_resource($resource->id));
// Sync members using a payload which includes two new members only (i.e. not the original launching user).
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(range(2, 3)));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(range(2, 3)));
ob_start();
$task->execute();
@@ -568,14 +575,14 @@ class sync_members_test extends \lti_advantage_testcase {
$userrepo = new user_repository();
// Launch the tool for a user.
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids([1])[0]);
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids([1])[0]);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
$this->assertCount(1, $userrepo->find_by_resource($resource->id));
// If the task were to run, this would trigger 1 unenrolment (the launching user) and 3 enrolments.
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(range(2, 2)));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(range(2, 2)));
$task->execute();
// Verify that the sync didn't take place.
@@ -594,14 +601,14 @@ class sync_members_test extends \lti_advantage_testcase {
$userrepo = new user_repository();
// Launch the tool for a user.
- $mocklaunch = $this->get_mock_launch($resource, $this->get_mock_launch_users_with_ids([1])[0]);
+ $mocklaunch = $this->get_mock_launch($resource, self::get_mock_launch_users_with_ids([1])[0]);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
$launchservice->user_launches_tool($instructoruser, $mocklaunch);
$this->assertCount(1, $userrepo->find_by_resource($resource->id));
// If the task were to run, this would trigger 1 unenrolment of the launching user and enrolment of 3 users.
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(range(2, 2)));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(range(2, 2)));
$task->execute();
// Verify that the sync didn't take place.
@@ -630,7 +637,7 @@ class sync_members_test extends \lti_advantage_testcase {
course_delete_module($modcontext->instanceid);
// Only the enabled resource 3 should sync members.
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(range(1, 1)));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(range(1, 1)));
$task->execute();
$this->expectOutputRegex(
@@ -652,7 +659,7 @@ class sync_members_test extends \lti_advantage_testcase {
$userrepo = new user_repository();
// Launch the tool for a user.
- $mockinstructor = $this->get_mock_launch_users_with_ids([1])[0];
+ $mockinstructor = self::get_mock_launch_users_with_ids([1])[0];
$mocklaunch = $this->get_mock_launch($resource, $mockinstructor, null, null, false);
$launchservice = $this->get_tool_launch_service();
$instructoruser = $this->lti_advantage_user_authenticates('1');
@@ -660,7 +667,7 @@ class sync_members_test extends \lti_advantage_testcase {
$this->assertCount(1, $userrepo->find_by_resource($resource->id));
// The task would sync an additional 2 users if the link had NRPS service support.
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(range(2, 2)));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(range(2, 2)));
// We expect the task to report that it is skipping the resource due to a lack of NRPS support.
$task->execute();
@@ -693,12 +700,12 @@ class sync_members_test extends \lti_advantage_testcase {
$authenticateduser = \core_user::get_user($authenticateduser->id);
// Mock the launch for the specified user.
- $mocklaunchuser = $this->get_mock_launch_users_with_ids([$authenticateduser->id])[0];
+ $mocklaunchuser = self::get_mock_launch_users_with_ids([$authenticateduser->id])[0];
$mocklaunch = $this->get_mock_launch($resource, $mocklaunchuser);
$this->get_tool_launch_service()->user_launches_tool($authenticateduser, $mocklaunch);
// Prepare the sync task, with a stubbed list of members.
- $task = $this->get_mock_task_with_users($this->get_mock_members_with_ids(['123'], null, true, true, true, true));
+ $task = $this->get_mock_task_with_users(self::get_mock_members_with_ids(['123'], null, true, true, true, true));
// Run the member sync.
$this->expectOutputRegex(
@@ -788,7 +795,7 @@ class sync_members_test extends \lti_advantage_testcase {
*
* @return array[] the array of test data.
*/
- public function member_sync_data_provider(): array {
+ public static function member_sync_data_provider(): array {
global $CFG;
require_once($CFG->dirroot . '/auth/lti/auth.php');
return [
@@ -806,7 +813,7 @@ class sync_members_test extends \lti_advantage_testcase {
],
'resource_config' => null,
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => [
'consumer_key' => 'CONSUMER_1',
'signing_secret' => 'toolsecret1',
@@ -817,10 +824,10 @@ class sync_members_test extends \lti_advantage_testcase {
],
],
'sync_members_data' => [
- $this->get_mock_members_with_ids(['1p3_1'], ['1'])[0],
- $this->get_mock_members_with_ids(['1p3_2'], ['2'])[0],
- $this->get_mock_members_with_ids(['1p3_3'], ['3'])[0],
- $this->get_mock_members_with_ids(['1p3_4'], ['4'])[0],
+ self::get_mock_members_with_ids(['1p3_1'], ['1'])[0],
+ self::get_mock_members_with_ids(['1p3_2'], ['2'])[0],
+ self::get_mock_members_with_ids(['1p3_3'], ['3'])[0],
+ self::get_mock_members_with_ids(['1p3_4'], ['4'])[0],
],
'expected' => [
'enrolments' => [
@@ -857,7 +864,7 @@ class sync_members_test extends \lti_advantage_testcase {
],
'resource_config' => null,
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1'])[0],
'launch_migration_claim' => [
'consumer_key' => 'CONSUMER_1',
'signing_secret' => 'toolsecret1',
@@ -867,10 +874,10 @@ class sync_members_test extends \lti_advantage_testcase {
],
],
'sync_members_data' => [
- $this->get_mock_members_with_ids(['1'], null)[0],
- $this->get_mock_members_with_ids(['2'], null)[0],
- $this->get_mock_members_with_ids(['3'], null)[0],
- $this->get_mock_members_with_ids(['4'], null)[0],
+ self::get_mock_members_with_ids(['1'], null)[0],
+ self::get_mock_members_with_ids(['2'], null)[0],
+ self::get_mock_members_with_ids(['3'], null)[0],
+ self::get_mock_members_with_ids(['4'], null)[0],
],
'expected' => [
'enrolments' => [
@@ -907,14 +914,14 @@ class sync_members_test extends \lti_advantage_testcase {
],
'resource_config' => null,
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => null,
],
'sync_members_data' => [
- $this->get_mock_members_with_ids(['1p3_1'], null)[0],
- $this->get_mock_members_with_ids(['1p3_2'], null)[0],
- $this->get_mock_members_with_ids(['1p3_3'], null)[0],
- $this->get_mock_members_with_ids(['1p3_4'], null)[0],
+ self::get_mock_members_with_ids(['1p3_1'], null)[0],
+ self::get_mock_members_with_ids(['1p3_2'], null)[0],
+ self::get_mock_members_with_ids(['1p3_3'], null)[0],
+ self::get_mock_members_with_ids(['1p3_4'], null)[0],
],
'expected' => [
'enrolments' => [
@@ -951,14 +958,14 @@ class sync_members_test extends \lti_advantage_testcase {
],
'resource_config' => null,
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1'])[0],
'launch_migration_claim' => null,
],
'sync_members_data' => [
- $this->get_mock_members_with_ids(['1'], null)[0],
- $this->get_mock_members_with_ids(['2'], null)[0],
- $this->get_mock_members_with_ids(['3'], null)[0],
- $this->get_mock_members_with_ids(['4'], null)[0],
+ self::get_mock_members_with_ids(['1'], null)[0],
+ self::get_mock_members_with_ids(['2'], null)[0],
+ self::get_mock_members_with_ids(['3'], null)[0],
+ self::get_mock_members_with_ids(['4'], null)[0],
],
'expected' => [
'enrolments' => [
@@ -995,14 +1002,14 @@ class sync_members_test extends \lti_advantage_testcase {
],
'resource_config' => null,
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => null,
],
'sync_members_data' => [
- $this->get_mock_members_with_ids(['1p3_1'], ['1'])[0],
- $this->get_mock_members_with_ids(['1p3_2'], ['2'])[0],
- $this->get_mock_members_with_ids(['1p3_3'], ['3'])[0],
- $this->get_mock_members_with_ids(['1p3_4'], ['4'])[0],
+ self::get_mock_members_with_ids(['1p3_1'], ['1'])[0],
+ self::get_mock_members_with_ids(['1p3_2'], ['2'])[0],
+ self::get_mock_members_with_ids(['1p3_3'], ['3'])[0],
+ self::get_mock_members_with_ids(['1p3_4'], ['4'])[0],
],
'expected' => [
'enrolments' => [
@@ -1032,24 +1039,24 @@ class sync_members_test extends \lti_advantage_testcase {
'provisioningmodeinstructor' => \auth_plugin_lti::PROVISIONING_MODE_PROMPT_NEW_EXISTING
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => null,
],
'sync_members_data' => [
// This user is just an instructor but is also the user who is already linked, via the launch above.
- $this->get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
])[0],
// This user is just a learner.
- $this->get_mock_members_with_ids(['1p3_2'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_2'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
// This user is also a learner.
- $this->get_mock_members_with_ids(['1p3_3'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_3'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
// This user is both an instructor and a learner.
- $this->get_mock_members_with_ids(['1p3_4'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_4'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
@@ -1082,24 +1089,24 @@ class sync_members_test extends \lti_advantage_testcase {
'provisioningmodeinstructor' => \auth_plugin_lti::PROVISIONING_MODE_AUTO_ONLY
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => null,
],
'sync_members_data' => [
// This user is just an instructor but is also the user who is already linked, via the launch above.
- $this->get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
])[0],
// This user is just a learner.
- $this->get_mock_members_with_ids(['1p3_2'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_2'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
// This user is also a learner.
- $this->get_mock_members_with_ids(['1p3_3'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_3'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
// This user is both an instructor and a learner.
- $this->get_mock_members_with_ids(['1p3_4'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_4'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
@@ -1132,24 +1139,24 @@ class sync_members_test extends \lti_advantage_testcase {
'provisioningmodeinstructor' => \auth_plugin_lti::PROVISIONING_MODE_PROMPT_NEW_EXISTING
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => null,
],
'sync_members_data' => [
// This user is just an instructor but is also the user who is already linked, via the launch above.
- $this->get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
])[0],
// This user is just a learner.
- $this->get_mock_members_with_ids(['1p3_2'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_2'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
// This user is also a learner.
- $this->get_mock_members_with_ids(['1p3_3'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_3'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
// This user is both an instructor and a learner.
- $this->get_mock_members_with_ids(['1p3_4'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_4'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
@@ -1194,7 +1201,7 @@ class sync_members_test extends \lti_advantage_testcase {
'provisioningmodeinstructor' => \auth_plugin_lti::PROVISIONING_MODE_AUTO_ONLY
],
'launch_data' => [
- 'user' => $this->get_mock_launch_users_with_ids(['1p3_1'])[0],
+ 'user' => self::get_mock_launch_users_with_ids(['1p3_1'])[0],
'launch_migration_claim' => [
'consumer_key' => 'CONSUMER_1',
'signing_secret' => 'toolsecret1',
@@ -1205,24 +1212,24 @@ class sync_members_test extends \lti_advantage_testcase {
],
'sync_members_data' => [
// This user is just an instructor but is also the user who is already linked, via the launch above.
- $this->get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_1'], null, true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
])[0],
// This user is just a learner.
- $this->get_mock_members_with_ids(['1p3_2'], ['2'], true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_2'], ['2'], true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
// This user is also a learner.
- $this->get_mock_members_with_ids(['1p3_3'], ['3'], true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_3'], ['3'], true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
// This user is both an instructor and a learner.
- $this->get_mock_members_with_ids(['1p3_4'], ['4'], true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_4'], ['4'], true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
'http://purl.imsglobal.org/vocab/lis/v2/membership#Learner'
])[0],
// This user is just an instructor who hasn't launched before (unlike the first user here).
- $this->get_mock_members_with_ids(['1p3_5'], ['5'], true, true, true, false, [
+ self::get_mock_members_with_ids(['1p3_5'], ['5'], true, true, true, false, [
'http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor',
])[0],
],
diff --git a/enrol/lti/tests/local/ltiadvantage/utility/message_helper_test.php b/enrol/lti/tests/local/ltiadvantage/utility/message_helper_test.php
index af1240f6614..b021b661070 100644
--- a/enrol/lti/tests/local/ltiadvantage/utility/message_helper_test.php
+++ b/enrol/lti/tests/local/ltiadvantage/utility/message_helper_test.php
@@ -43,7 +43,7 @@ class message_helper_test extends \base_testcase {
*
* @return array the array of test JWT data.
*/
- public function message_roles_provider(): array {
+ public static function message_roles_provider(): array {
return [
'Roles claim present, includes learner role only' => [
'jwtdata' => [
diff --git a/enrol/manual/tests/lib_test.php b/enrol/manual/tests/lib_test.php
index 576ac36e4c1..cd1502adf85 100644
--- a/enrol/manual/tests/lib_test.php
+++ b/enrol/manual/tests/lib_test.php
@@ -586,7 +586,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function default_enrolment_instance_data_provider(): array {
+ public static function default_enrolment_instance_data_provider(): array {
$studentroles = get_archetype_roles('student');
$studentrole = array_shift($studentroles);
@@ -700,7 +700,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function update_enrolment_instance_data_provider(): array {
+ public static function update_enrolment_instance_data_provider(): array {
$studentroles = get_archetype_roles('student');
$studentrole = array_shift($studentroles);
diff --git a/enrol/tests/course_enrolment_manager_test.php b/enrol/tests/course_enrolment_manager_test.php
index 7785fce81f0..c636cdb54bb 100644
--- a/enrol/tests/course_enrolment_manager_test.php
+++ b/enrol/tests/course_enrolment_manager_test.php
@@ -504,7 +504,7 @@ class course_enrolment_manager_test extends \advanced_testcase {
*
* @return array Dataset
*/
- public function search_users_provider() {
+ public static function search_users_provider(): array {
return [
[2, false, 2, 3, true],
[5, false, 3, 3, false],
diff --git a/enrol/tests/enrollib_test.php b/enrol/tests/enrollib_test.php
index 6d5f90c7389..81d337fcadf 100644
--- a/enrol/tests/enrollib_test.php
+++ b/enrol/tests/enrollib_test.php
@@ -381,7 +381,7 @@ class enrollib_test extends advanced_testcase {
*
* @return array
*/
- public function enrol_course_delete_with_userid_provider() {
+ public static function enrol_course_delete_with_userid_provider(): array {
return [
'The teacher can un-enrol users in a course' =>
[
@@ -1028,7 +1028,7 @@ class enrollib_test extends advanced_testcase {
*
* @return array
*/
- public function enrol_get_my_courses_by_time_provider(): array {
+ public static function enrol_get_my_courses_by_time_provider(): array {
return [
'No start or end time' =>
[null, null, true],
@@ -1190,7 +1190,7 @@ class enrollib_test extends advanced_testcase {
/**
* Test cases for the test_enrol_get_my_courses_sort_by_last_access test.
*/
- public function get_enrol_get_my_courses_sort_by_last_access_test_cases() {
+ public static function get_enrol_get_my_courses_sort_by_last_access_test_cases(): array {
$now = time();
$enrolledcoursesdata = [
@@ -1293,7 +1293,7 @@ class enrollib_test extends advanced_testcase {
/**
* Test the get_enrolled_courses_by_timeline_classification function.
*
- * @dataProvider get_enrol_get_my_courses_sort_by_last_access_test_cases()
+ * @dataProvider get_enrol_get_my_courses_sort_by_last_access_test_cases
* @param array $enrolledcoursesdata Courses to create and enrol the user in
* @param array $unenrolledcoursesdata Courses to create nut not enrol the user in
* @param string $sort Sort string for the enrol function
@@ -1443,7 +1443,7 @@ class enrollib_test extends advanced_testcase {
/**
* Test get_enrolled_with_capabilities_join cannotmatchanyrows attribute.
*
- * @dataProvider get_enrolled_with_capabilities_join_cannotmatchanyrows_data()
+ * @dataProvider get_enrolled_with_capabilities_join_cannotmatchanyrows_data
* @param string $capability the tested capability
* @param bool $useprohibit if the capability must be assigned to prohibit
* @param int $expectedmatch expected cannotmatchanyrows value
@@ -1490,7 +1490,7 @@ class enrollib_test extends advanced_testcase {
*
* @return @array of testing scenarios
*/
- public function get_enrolled_with_capabilities_join_cannotmatchanyrows_data() {
+ public static function get_enrolled_with_capabilities_join_cannotmatchanyrows_data(): array {
return [
'no prohibits, no capability' => [
'capability' => '',
@@ -1530,7 +1530,7 @@ class enrollib_test extends advanced_testcase {
* Data provided for test_enrol_check_plugins_with_empty_config_value test.
* @return array
*/
- public function empty_config_data_provider(): array {
+ public static function empty_config_data_provider(): array {
return [
[0],
["0"],
diff --git a/files/converter/unoconv/tests/converter_test.php b/files/converter/unoconv/tests/converter_test.php
index a83941f79a4..fb8dd4694f5 100644
--- a/files/converter/unoconv/tests/converter_test.php
+++ b/files/converter/unoconv/tests/converter_test.php
@@ -114,7 +114,7 @@ class converter_test extends \advanced_testcase {
*
* @return array
*/
- public function provider_test_unoconv_path() {
+ public static function provider_test_unoconv_path(): array {
return [
'Empty path' => [
'path' => null,
diff --git a/filter/tex/tests/lib_test.php b/filter/tex/tests/lib_test.php
index 3aff90fb55e..cc05ad521d6 100644
--- a/filter/tex/tests/lib_test.php
+++ b/filter/tex/tests/lib_test.php
@@ -44,7 +44,7 @@ class lib_test extends advanced_testcase {
*
* @return array
*/
- public function filter_tex_sanitize_formula_provider(): array {
+ public static function filter_tex_sanitize_formula_provider(): array {
return [
['x\ =\ \frac{\sqrt{144}}{2}\ \times\ (y\ +\ 12)', 'x\ =\ \frac{\sqrt{144}}{2}\ \times\ (y\ +\ 12)'],
['\usepackage[latin1]{inputenc}', '\usepackage[latin1]{inputenc}'],
diff --git a/grade/import/csv/tests/load_data_test.php b/grade/import/csv/tests/load_data_test.php
index c09820c28d9..4f275f14f3a 100644
--- a/grade/import/csv/tests/load_data_test.php
+++ b/grade/import/csv/tests/load_data_test.php
@@ -242,7 +242,7 @@ Bobby,Bunce,,"Moodle HQ","Rock on!",student5@example.com,75.00,,75.00,{exportdat
*
* @return array
*/
- public function check_user_exists_provider() {
+ public static function check_user_exists_provider(): array {
return [
'Fetch by email' => [
'email', 's1@example.com', true
diff --git a/grade/report/overview/tests/lib_test.php b/grade/report/overview/tests/lib_test.php
index 56e2126ed16..256ed514fac 100644
--- a/grade/report/overview/tests/lib_test.php
+++ b/grade/report/overview/tests/lib_test.php
@@ -41,7 +41,7 @@ class lib_test extends \advanced_testcase {
*
* @return array Two options, one with true and one with false
*/
- public function true_or_false(): array {
+ public static function true_or_false(): array {
return [
[true],
[false]
diff --git a/grade/tests/component_gradeitems_test.php b/grade/tests/component_gradeitems_test.php
index a37c22d01c2..764be060802 100644
--- a/grade/tests/component_gradeitems_test.php
+++ b/grade/tests/component_gradeitems_test.php
@@ -76,7 +76,7 @@ namespace core_grades {
*
* @return array
*/
- public function is_valid_itemname_provider(): array {
+ public static function is_valid_itemname_provider(): array {
return [
'valid' => [
'someother',
@@ -173,7 +173,7 @@ namespace core_grades {
*
* @return array
*/
- public function is_advancedgrading_itemname_provider(): array {
+ public static function is_advancedgrading_itemname_provider(): array {
return [
'valid' => [
'someother',
@@ -209,7 +209,7 @@ namespace core_grades {
*
* @return array
*/
- public function get_field_name_for_itemnumber_provider(): array {
+ public static function get_field_name_for_itemnumber_provider(): array {
return [
'Valid itemnumber 0 case 1' => [
0,
@@ -291,7 +291,7 @@ namespace core_grades {
*
* @return array
*/
- public function get_field_name_for_itemname_provider(): array {
+ public static function get_field_name_for_itemname_provider(): array {
return [
'Empty itemname empty case 1' => [
'',
@@ -393,7 +393,7 @@ namespace core_grades {
*
* @return array
*/
- public function get_itemname_from_itemnumber_provider(): array {
+ public static function get_itemname_from_itemnumber_provider(): array {
return [
'Valid itemnumber 0' => [
0,
@@ -471,7 +471,7 @@ namespace core_grades {
*
* @return array
*/
- public function get_itemnumber_from_itemname_provider(): array {
+ public static function get_itemnumber_from_itemname_provider(): array {
return [
'Empty itemname empty' => [
'',
diff --git a/grade/tests/export_test.php b/grade/tests/export_test.php
index 870319e810e..7ca3ff2c01d 100644
--- a/grade/tests/export_test.php
+++ b/grade/tests/export_test.php
@@ -127,7 +127,7 @@ class export_test extends \advanced_testcase {
*
* @return array
*/
- public function format_feedback_provider(): array {
+ public static function format_feedback_provider(): array {
return [
'Basic string (PLAIN)' => [
'This is an example string',
diff --git a/grade/tests/external/get_feedback_test.php b/grade/tests/external/get_feedback_test.php
index 66c0fb064ce..cf236d814f2 100644
--- a/grade/tests/external/get_feedback_test.php
+++ b/grade/tests/external/get_feedback_test.php
@@ -77,7 +77,7 @@ class get_feedback_test extends \externallib_advanced_testcase {
*
* @return array
*/
- public function get_feedback_provider(): array {
+ public static function get_feedback_provider(): array {
return [
'Return when feedback is set.' => [
'Test feedback',
@@ -153,7 +153,7 @@ class get_feedback_test extends \externallib_advanced_testcase {
*
* @return array
*/
- public function get_feedback_invalid_request_provider(): array {
+ public static function get_feedback_invalid_request_provider(): array {
return [
'Logged user does not have permissions to view feedback.' => [
'user',
diff --git a/grade/tests/external/get_gradable_users_test.php b/grade/tests/external/get_gradable_users_test.php
index ae018bfdd3c..7b76c5127a8 100644
--- a/grade/tests/external/get_gradable_users_test.php
+++ b/grade/tests/external/get_gradable_users_test.php
@@ -100,7 +100,7 @@ class get_gradable_users_test extends \externallib_advanced_testcase {
*
* @return array
*/
- public function execute_data(): array {
+ public static function execute_data(): array {
return [
'All users' => [
false,
diff --git a/grade/tests/grades/grader/gradingpanel/point/external/store_test.php b/grade/tests/grades/grader/gradingpanel/point/external/store_test.php
index 3467230cee9..ceea1d288a5 100644
--- a/grade/tests/grades/grader/gradingpanel/point/external/store_test.php
+++ b/grade/tests/grades/grader/gradingpanel/point/external/store_test.php
@@ -293,7 +293,7 @@ class store_test extends advanced_testcase {
*
* @return array
*/
- public function execute_out_of_range_provider(): array {
+ public static function execute_out_of_range_provider(): array {
return [
'above' => [
'max' => 100,
diff --git a/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php b/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php
index ec9ddfe0dfa..6a0d91fec77 100644
--- a/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php
+++ b/grade/tests/grades/grader/gradingpanel/scale/external/store_test.php
@@ -398,7 +398,7 @@ class store_test extends advanced_testcase {
*
* @return array
*/
- public function execute_out_of_range_provider(): array {
+ public static function execute_out_of_range_provider(): array {
return [
'above' => [
'supplied' => 500,
diff --git a/grade/tests/lib_test.php b/grade/tests/lib_test.php
index a616657626e..5a1ac50ebba 100644
--- a/grade/tests/lib_test.php
+++ b/grade/tests/lib_test.php
@@ -370,7 +370,7 @@ class lib_test extends \advanced_testcase {
/**
* Tests that ungraded_counts calculates count and sum of grades correctly when there are hidden grades.
- * @dataProvider ungraded_counts_hidden_grades_data()
+ * @dataProvider ungraded_counts_hidden_grades_data
* @param bool $hidden Whether to inlcude hidden grades or not.
* @param array $expectedcount expected count value (i.e. number of ugraded grades)
* @param array $expectedsumarray expceted sum of grades
@@ -457,7 +457,7 @@ class lib_test extends \advanced_testcase {
*
* @return array of testing scenarios
*/
- public function ungraded_counts_hidden_grades_data(): array {
+ public static function ungraded_counts_hidden_grades_data(): array {
return [
'nohidden' => [
'hidden' => false,
@@ -630,7 +630,7 @@ class lib_test extends \advanced_testcase {
/**
* Tests that ungraded_counts calculates count and sum of grades correctly when there are hidden grades.
- * @dataProvider ungraded_counts_only_active_enrol_data()
+ * @dataProvider ungraded_counts_only_active_enrol_data
* @param bool $onlyactive Site setting to show only active users.
* @param int $hascapability Capability constant
* @param bool|null $showonlyactiveenrolpref Show only active user preference.
@@ -730,7 +730,7 @@ class lib_test extends \advanced_testcase {
*
* @return array of testing scenarios
*/
- public function ungraded_counts_only_active_enrol_data(): array {
+ public static function ungraded_counts_only_active_enrol_data(): array {
return [
'Show only active and no user preference' => [
'onlyactive' => true,
@@ -786,7 +786,7 @@ class lib_test extends \advanced_testcase {
/**
* Tests for calculate_average.
- * @dataProvider calculate_average_data()
+ * @dataProvider calculate_average_data
* @param int $meanselection Whether to inlcude all grades or non-empty grades in aggregation.
* @param array $expectedmeancount expected meancount value
* @param array $expectedaverage expceted average value
@@ -878,7 +878,7 @@ class lib_test extends \advanced_testcase {
*
* @return array of testing scenarios
*/
- public function calculate_average_data(): array {
+ public static function calculate_average_data(): array {
return [
'Non-empty grades' => [
'meanselection' => 1,
diff --git a/grade/tests/output/general_action_bar_test.php b/grade/tests/output/general_action_bar_test.php
index d3439522c05..f108521fa7a 100644
--- a/grade/tests/output/general_action_bar_test.php
+++ b/grade/tests/output/general_action_bar_test.php
@@ -156,7 +156,7 @@ class general_action_bar_test extends advanced_testcase {
*
* @return array
*/
- public function export_for_template_provider(): array {
+ public static function export_for_template_provider(): array {
$graderpluginname = get_string('pluginname', 'gradereport_grader');
$historypluginname = get_string('pluginname', 'gradereport_history');
$outcomespluginname = get_string('pluginname', 'gradereport_outcomes');
diff --git a/group/tests/reportbuilder/datasource/groups_test.php b/group/tests/reportbuilder/datasource/groups_test.php
index cf67b9c5698..5e07464c208 100644
--- a/group/tests/reportbuilder/datasource/groups_test.php
+++ b/group/tests/reportbuilder/datasource/groups_test.php
@@ -232,7 +232,7 @@ class groups_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
- public function datasource_filters_provider(): array {
+ public static function datasource_filters_provider(): array {
return [
// Course (just to test join).
'Filter course name' => ['course:fullname', [
diff --git a/h5p/tests/api_test.php b/h5p/tests/api_test.php
index ae497f4797b..24ad1d71ca9 100644
--- a/h5p/tests/api_test.php
+++ b/h5p/tests/api_test.php
@@ -98,7 +98,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function delete_library_provider(): array {
+ public static function delete_library_provider(): array {
return [
'Delete MainLibrary' => [
'MainLibrary',
@@ -192,7 +192,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function get_dependent_libraries_provider(): array {
+ public static function get_dependent_libraries_provider(): array {
return [
'Main library of a content' => [
'MainLibrary',
@@ -256,7 +256,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function get_library_provider(): array {
+ public static function get_library_provider(): array {
return [
'Main library of a content' => [
'MainLibrary',
@@ -529,7 +529,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function can_edit_content_provider(): array {
+ public static function can_edit_content_provider(): array {
return [
// Component = user.
'user: Admin user is author' => [
@@ -963,7 +963,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function set_library_enabled_provider(): array {
+ public static function set_library_enabled_provider(): array {
return [
'Disable existing library' => [
'libraryname' => 'MainLibrary',
@@ -1068,7 +1068,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function is_library_enabled_provider(): array {
+ public static function is_library_enabled_provider(): array {
return [
'Library with 2 versions, one of them disabled' => [
'libraryname' => 'H5P.Lib1',
@@ -1194,7 +1194,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function is_valid_package_provider(): array {
+ public static function is_valid_package_provider(): array {
return [
'Valid H5P file (as admin)' => [
'filename' => '/fixtures/greeting-card.h5p',
diff --git a/h5p/tests/editor_ajax_test.php b/h5p/tests/editor_ajax_test.php
index f09de5145a8..318f2478b42 100644
--- a/h5p/tests/editor_ajax_test.php
+++ b/h5p/tests/editor_ajax_test.php
@@ -161,7 +161,7 @@ class editor_ajax_test extends \advanced_testcase {
*
* @return array
*/
- public function get_translations_provider(): array {
+ public static function get_translations_provider(): array {
return [
'No library' => [
[],
diff --git a/h5p/tests/editor_framework_test.php b/h5p/tests/editor_framework_test.php
index 1c93f87beb5..db142e1fc4c 100644
--- a/h5p/tests/editor_framework_test.php
+++ b/h5p/tests/editor_framework_test.php
@@ -125,7 +125,7 @@ class editor_framework_test extends \advanced_testcase {
*
* @return array
*/
- public function get_language_provider(): array {
+ public static function get_language_provider(): array {
return [
'No library' => [
[],
@@ -289,7 +289,7 @@ class editor_framework_test extends \advanced_testcase {
*
* @return array
*/
- public function get_available_languages_provider(): array {
+ public static function get_available_languages_provider(): array {
return [
'No library' => [
[],
diff --git a/h5p/tests/file_storage_test.php b/h5p/tests/file_storage_test.php
index 812c455d1fa..0c8b6deb74a 100644
--- a/h5p/tests/file_storage_test.php
+++ b/h5p/tests/file_storage_test.php
@@ -597,7 +597,7 @@ class file_storage_test extends \advanced_testcase {
*
* @return array
*/
- public function get_icon_url_provider(): array {
+ public static function get_icon_url_provider(): array {
return [
'Icon included' => [
'filltheblanks.h5p',
diff --git a/h5p/tests/framework_test.php b/h5p/tests/framework_test.php
index 1f2f94596aa..29a8702e633 100644
--- a/h5p/tests/framework_test.php
+++ b/h5p/tests/framework_test.php
@@ -656,7 +656,7 @@ class framework_test extends \advanced_testcase {
*
* @return array
*/
- public function isPatchedLibrary_provider(): array {
+ public static function isPatchedLibrary_provider(): array {
return [
'Unpatched library. No different versioning' => [
[
@@ -1556,7 +1556,7 @@ class framework_test extends \advanced_testcase {
*
* @return array
*/
- public function loadLibrarySemantics_provider(): array {
+ public static function loadLibrarySemantics_provider(): array {
$semantics = json_encode(
[
@@ -2347,7 +2347,7 @@ class framework_test extends \advanced_testcase {
*
* @return array
*/
- public function libraryHasUpgrade_provider(): array {
+ public static function libraryHasUpgrade_provider(): array {
return [
'Lower major version; Identical lower version' => [
[
diff --git a/h5p/tests/generator_test.php b/h5p/tests/generator_test.php
index e61bdcf4361..b33a5d6420f 100644
--- a/h5p/tests/generator_test.php
+++ b/h5p/tests/generator_test.php
@@ -195,7 +195,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
- public function generate_h5p_data_files_creation_provider(): array {
+ public static function generate_h5p_data_files_creation_provider(): array {
return [
'Do not create library related files on the filesystem' => [
false,
@@ -304,7 +304,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
- public function generate_h5p_data_xapistates_provider(): array {
+ public static function generate_h5p_data_xapistates_provider(): array {
return [
'Do not create the file nor xAPI states' => [
'filerecord' => null,
@@ -391,7 +391,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
- public function create_h5p_record_provider(): array {
+ public static function create_h5p_record_provider(): array {
$createdjsoncontent = json_encode(
array(
'text' => 'Created dummy text<\/p>\n',
@@ -512,7 +512,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
- public function create_contents_libraries_record_provider(): array {
+ public static function create_contents_libraries_record_provider(): array {
return [
'Create h5p content library with set dependency type' => [
[
@@ -572,7 +572,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
- public function create_library_dependency_record_provider(): array {
+ public static function create_library_dependency_record_provider(): array {
return [
'Create h5p library dependency with set dependency type' => [
[
@@ -638,7 +638,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
**/
- public function create_content_file_provider(): array {
+ public static function create_content_file_provider(): array {
return [
'Create file in content with id 4' => [
[
diff --git a/h5p/tests/helper_test.php b/h5p/tests/helper_test.php
index 081e3ad4734..b219871bde1 100644
--- a/h5p/tests/helper_test.php
+++ b/h5p/tests/helper_test.php
@@ -78,7 +78,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
- public function display_options_provider(): array {
+ public static function display_options_provider(): array {
return [
'All display options disabled' => [
false,
@@ -468,7 +468,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
- public function parse_js_array_provider(): array {
+ public static function parse_js_array_provider(): array {
$lines = [
"{",
" missingTranslation: '[Missing translation :key]',",
diff --git a/h5p/tests/local/library/handler_test.php b/h5p/tests/local/library/handler_test.php
index 6e366d4ae2c..3298b1185d6 100644
--- a/h5p/tests/local/library/handler_test.php
+++ b/h5p/tests/local/library/handler_test.php
@@ -54,7 +54,7 @@ class handler_test extends advanced_testcase {
*
* @return array
*/
- public function get_h5p_string_provider(): array {
+ public static function get_h5p_string_provider(): array {
return [
'Existing string in h5plib plugin' => [
'editor:add',
diff --git a/iplookup/tests/geoip_test.php b/iplookup/tests/geoip_test.php
index d82882b18d6..f623f26dc0c 100644
--- a/iplookup/tests/geoip_test.php
+++ b/iplookup/tests/geoip_test.php
@@ -16,14 +16,6 @@
namespace core;
-defined('MOODLE_INTERNAL') || die();
-
-global $CFG;
-
-require_once("{$CFG->libdir}/filelib.php");
-require_once("{$CFG->dirroot}/iplookup/lib.php");
-
-
/**
* GeoIp data file parsing test.
*
@@ -32,16 +24,21 @@ require_once("{$CFG->dirroot}/iplookup/lib.php");
* @copyright 2012 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class geoip_test extends \advanced_testcase {
- public function setUp(): void {
- parent::setUp();
- $this->resetAfterTest();
+final class geoip_test extends \advanced_testcase {
+ #[\Override]
+ public static function setUpBeforeClass(): void {
+ global $CFG;
+
+ parent::setUpBeforeClass();
+
+ require_once("{$CFG->libdir}/filelib.php");
+ require_once("{$CFG->dirroot}/iplookup/lib.php");
}
/**
* Setup the GeoIP2File system.
*/
- public function setup_geoip2file() {
+ public function setup_geoip2file(): void {
global $CFG;
$CFG->geoip2file = "$CFG->dirroot/iplookup/tests/fixtures/GeoIP2-City-Test.mmdb";
}
@@ -53,6 +50,8 @@ class geoip_test extends \advanced_testcase {
* @param string $ip The IP to test
*/
public function test_ip($ip): void {
+ $this->resetAfterTest();
+
$this->setup_geoip2file();
// Note: The results we get from the iplookup tests are beyond our control.
@@ -77,7 +76,7 @@ class geoip_test extends \advanced_testcase {
*
* @return array
*/
- public function ip_provider() {
+ public static function ip_provider(): array {
return [
'IPv4: IPV4 test' => ['81.2.69.142'],
'IPv6: IPV6 test' => ['2001:252:1::1:1:1'],
diff --git a/lib/ddl/tests/ddl_test.php b/lib/ddl/tests/ddl_test.php
index 8f5c1d088c9..68e9053f0f3 100644
--- a/lib/ddl/tests/ddl_test.php
+++ b/lib/ddl/tests/ddl_test.php
@@ -2264,7 +2264,7 @@ class ddl_test extends \database_driver_testcase {
*
* @return array The type-value pair fixture.
*/
- public function get_enc_quoted_provider() {
+ public static function get_enc_quoted_provider(): array {
return array(
// Reserved: some examples from SQL-92.
[true, 'from'],
@@ -2313,7 +2313,7 @@ class ddl_test extends \database_driver_testcase {
*
* @return array The type-old-new tuple fixture.
*/
- public function sql_generator_get_rename_field_sql_provider() {
+ public static function sql_generator_get_rename_field_sql_provider(): array {
return array(
// Reserved: an example from SQL-92.
// Both names should be reserved.
diff --git a/lib/dml/tests/dml_read_slave_test.php b/lib/dml/tests/dml_read_slave_test.php
index 5bd00d0ab94..fd51af34711 100644
--- a/lib/dml/tests/dml_read_slave_test.php
+++ b/lib/dml/tests/dml_read_slave_test.php
@@ -94,7 +94,7 @@ class dml_read_slave_test extends \base_testcase {
* @return array
* @dataProvider table_names_provider
*/
- public function table_names_provider(): array {
+ public static function table_names_provider(): array {
return [
[
"SELECT *
diff --git a/lib/dml/tests/dml_table_test.php b/lib/dml/tests/dml_table_test.php
index f0ef6ecc8bd..40c75b3f7c8 100644
--- a/lib/dml/tests/dml_table_test.php
+++ b/lib/dml/tests/dml_table_test.php
@@ -35,7 +35,7 @@ class dml_table_test extends \database_driver_testcase {
*
* @return array
*/
- public function get_field_select_provider(): array {
+ public static function get_field_select_provider(): array {
return [
'single field' => [
'tablename' => 'test_table_single',
@@ -102,7 +102,7 @@ class dml_table_test extends \database_driver_testcase {
*
* @return array
*/
- public function extract_from_result_provider(): array {
+ public static function extract_from_result_provider(): array {
return [
'single table' => [
'fieldlist' => [
diff --git a/lib/dml/tests/dml_test.php b/lib/dml/tests/dml_test.php
index d4390771354..047557f9794 100644
--- a/lib/dml/tests/dml_test.php
+++ b/lib/dml/tests/dml_test.php
@@ -4473,7 +4473,7 @@ EOD;
}
- public function sql_concat_join_provider() {
+ public static function sql_concat_join_provider(): array {
return array(
// All strings.
array(
@@ -6315,7 +6315,7 @@ EOD;
* @return array[]
* @see \mysqli_native_moodle_database::get_server_info
*/
- public function get_server_info_mysql_provider() {
+ public static function get_server_info_mysql_provider(): array {
return [
'MySQL 5.7.39 - MySQLi version' => [
'5.7.39-log',
diff --git a/lib/dml/tests/sqlsrv_native_moodle_database_test.php b/lib/dml/tests/sqlsrv_native_moodle_database_test.php
index 6d32de1d229..92c9c5675e0 100644
--- a/lib/dml/tests/sqlsrv_native_moodle_database_test.php
+++ b/lib/dml/tests/sqlsrv_native_moodle_database_test.php
@@ -40,8 +40,7 @@ require_once($CFG->dirroot.'/lib/dml/sqlsrv_native_moodle_database.php');
* @copyright 2017 John Okely
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class sqlsrv_native_moodle_database_test extends \advanced_testcase {
-
+final class sqlsrv_native_moodle_database_test extends \advanced_testcase {
public function setUp(): void {
parent::setUp();
$this->resetAfterTest();
@@ -51,7 +50,7 @@ class sqlsrv_native_moodle_database_test extends \advanced_testcase {
* Dataprovider for test_add_no_lock_to_temp_tables
* @return array Data for test_add_no_lock_to_temp_tables
*/
- public function add_no_lock_to_temp_tables_provider() {
+ public static function add_no_lock_to_temp_tables_provider(): array {
return [
"Basic temp table, nothing following" => [
'input' => 'SELECT * FROM {table_temp}',
@@ -142,7 +141,7 @@ class sqlsrv_native_moodle_database_test extends \advanced_testcase {
*
* @return array data for test_has_query_order_by
*/
- public function has_query_order_by_provider() {
+ public static function has_query_order_by_provider(): array {
// Fixtures taken from https://docs.moodle.org/en/ad-hoc_contributed_reports.
return [
diff --git a/lib/external/tests/external_api_test.php b/lib/external/tests/external_api_test.php
index 49bbedae95a..a8b2afbe2d0 100644
--- a/lib/external/tests/external_api_test.php
+++ b/lib/external/tests/external_api_test.php
@@ -374,7 +374,7 @@ class external_api_test extends \advanced_testcase {
*
* @return array
*/
- public function all_external_info_provider(): array {
+ public static function all_external_info_provider(): array {
global $DB;
// We are testing here that all the external function descriptions can be generated without
diff --git a/lib/external/tests/external_value_test.php b/lib/external/tests/external_value_test.php
index a52c7b6b95e..e1014ba3278 100644
--- a/lib/external/tests/external_value_test.php
+++ b/lib/external/tests/external_value_test.php
@@ -34,7 +34,7 @@ class external_value_test extends advanced_testcase {
*
* @return array[]
*/
- public function required_param_provider(): array {
+ public static function required_param_provider(): array {
return [
[ VALUE_DEFAULT, false ],
[ VALUE_REQUIRED, false ],
diff --git a/lib/filestorage/tests/file_storage_test.php b/lib/filestorage/tests/file_storage_test.php
index 96136dae5e8..efe9fa26faa 100644
--- a/lib/filestorage/tests/file_storage_test.php
+++ b/lib/filestorage/tests/file_storage_test.php
@@ -2134,7 +2134,7 @@ class file_storage_test extends \advanced_testcase {
*
* @return array[]
*/
- public function filepath_mimetype_provider(): array {
+ public static function filepath_mimetype_provider(): array {
return [
[__DIR__ . '/fixtures/testimage.jpg', 'image/jpeg'],
[__DIR__ . '/fixtures/testimage.svg', 'image/svg+xml'],
diff --git a/lib/filestorage/tests/file_system_filedir_test.php b/lib/filestorage/tests/file_system_filedir_test.php
index 293e2ad16ec..91226a70008 100644
--- a/lib/filestorage/tests/file_system_filedir_test.php
+++ b/lib/filestorage/tests/file_system_filedir_test.php
@@ -1095,7 +1095,7 @@ class file_system_filedir_test extends \advanced_testcase {
*
* @return array
*/
- public function contenthash_dataprovider() {
+ public static function contenthash_dataprovider(): array {
return array(
array(
'contenthash' => 'eee4943847a35a4b6942c6f96daafde06bcfdfab',
diff --git a/lib/filestorage/tests/file_system_test.php b/lib/filestorage/tests/file_system_test.php
index 32a09cb4520..a61adfbd572 100644
--- a/lib/filestorage/tests/file_system_test.php
+++ b/lib/filestorage/tests/file_system_test.php
@@ -1238,7 +1238,7 @@ class file_system_test extends \advanced_testcase {
*
* @return array
*/
- public function is_image_from_storedfile_provider() {
+ public static function is_image_from_storedfile_provider(): array {
return array(
'Standard image' => array('image/png', true),
'Made up document/image' => array('document/image', false),
@@ -1250,7 +1250,7 @@ class file_system_test extends \advanced_testcase {
*
* @return array
*/
- public function get_local_path_from_storedfile_provider() {
+ public static function get_local_path_from_storedfile_provider(): array {
return [
'default args (nofetch)' => [
'args' => [],
diff --git a/lib/filestorage/tests/mbz_packer_test.php b/lib/filestorage/tests/mbz_packer_test.php
index 42e28d890d3..9dc662a16c9 100644
--- a/lib/filestorage/tests/mbz_packer_test.php
+++ b/lib/filestorage/tests/mbz_packer_test.php
@@ -89,7 +89,7 @@ class mbz_packer_test extends \advanced_testcase {
$this->assertEquals('frog', $out->get_content());
}
- public function usezipbackups_provider() {
+ public static function usezipbackups_provider(): array {
return [
'Use zips' => [true],
'Use tgz' => [false],
diff --git a/lib/form/tests/duration_test.php b/lib/form/tests/duration_test.php
index 2dd27de07ad..bb3b242f84f 100644
--- a/lib/form/tests/duration_test.php
+++ b/lib/form/tests/duration_test.php
@@ -96,7 +96,7 @@ class duration_test extends \basic_testcase {
*
* @return array test cases.
*/
- public function seconds_to_unit_cases(): array {
+ public static function seconds_to_unit_cases(): array {
return [
[[0, MINSECS], 0], // Zero minutes, for a nice default unit.
[[1, 1], 1],
@@ -137,7 +137,7 @@ class duration_test extends \basic_testcase {
*
* @return array test cases.
*/
- public function export_value_cases(): array {
+ public static function export_value_cases(): array {
return [
[10, '10', 1],
[9, '9.3', 1],
diff --git a/lib/form/tests/filetypes_util_test.php b/lib/form/tests/filetypes_util_test.php
index f1cd3d5f7c7..8a7a81011c9 100644
--- a/lib/form/tests/filetypes_util_test.php
+++ b/lib/form/tests/filetypes_util_test.php
@@ -14,36 +14,21 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-/**
- * Provides the {@link core_form\filetypes_util_testcase} class.
- *
- * @package core_form
- * @category test
- * @copyright 2017 David Mudrák
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
namespace core_form;
-use advanced_testcase;
-
-defined('MOODLE_INTERNAL') || die();
-
-global $CFG;
-
/**
* Test cases for the {@link core_form\filetypes_util} class.
*
+ * @package core_form
* @copyright 2017 David Mudrak
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @covers \core_form\filetypes_util
*/
-class filetypes_util_test extends advanced_testcase {
-
+final class filetypes_util_test extends \advanced_testcase {
/**
* Test normalizing list of extensions.
*/
public function test_normalize_file_types(): void {
-
$this->resetAfterTest(true);
$util = new filetypes_util();
@@ -75,7 +60,6 @@ class filetypes_util_test extends advanced_testcase {
* Test MIME type formal recognition.
*/
public function test_looks_like_mimetype(): void {
-
$this->resetAfterTest(true);
$util = new filetypes_util();
@@ -94,7 +78,6 @@ class filetypes_util_test extends advanced_testcase {
* Test getting/checking group.
*/
public function test_is_filetype_group(): void {
-
$this->resetAfterTest(true);
$util = new filetypes_util();
@@ -112,7 +95,6 @@ class filetypes_util_test extends advanced_testcase {
* Test describing list of extensions.
*/
public function test_describe_file_types(): void {
-
$this->resetAfterTest(true);
$util = new filetypes_util();
@@ -170,7 +152,6 @@ class filetypes_util_test extends advanced_testcase {
* Test expanding mime types into extensions.
*/
public function test_expand(): void {
-
$this->resetAfterTest(true);
$util = new filetypes_util();
@@ -208,7 +189,6 @@ class filetypes_util_test extends advanced_testcase {
* Test checking that a type is among others.
*/
public function test_is_listed(): void {
-
$this->resetAfterTest(true);
$util = new filetypes_util();
@@ -251,7 +231,6 @@ class filetypes_util_test extends advanced_testcase {
* Test getting types not present in a list.
*/
public function test_get_not_listed(): void {
-
$this->resetAfterTest(true);
$util = new filetypes_util();
@@ -274,7 +253,6 @@ class filetypes_util_test extends advanced_testcase {
* Test populating the tree for the browser.
*/
public function test_data_for_browser(): void {
-
$this->resetAfterTest(true);
$util = new filetypes_util();
@@ -359,7 +337,7 @@ class filetypes_util_test extends advanced_testcase {
*
* @return array
*/
- public function is_allowed_file_type_provider() {
+ public static function is_allowed_file_type_provider(): array {
return [
'Filetype not in extension list' => [
'filename' => 'test.xml',
@@ -421,7 +399,7 @@ class filetypes_util_test extends advanced_testcase {
*
* @return array
*/
- public function get_unknown_file_types_provider() {
+ public static function get_unknown_file_types_provider(): array {
return [
'Empty list' => [
'filetypes' => '',
diff --git a/lib/form/tests/privacy/provider_test.php b/lib/form/tests/privacy/provider_test.php
index f8c728f4781..6a71dc8f0a8 100644
--- a/lib/form/tests/privacy/provider_test.php
+++ b/lib/form/tests/privacy/provider_test.php
@@ -27,16 +27,13 @@ namespace core_form\privacy;
use core_form\privacy\provider;
use core_privacy\local\request\writer;
-defined('MOODLE_INTERNAL') || die();
-
/**
* Unit tests for the privacy API implementation.
*
* @copyright 2018 David Mudrák
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class provider_test extends \core_privacy\tests\provider_testcase {
-
+final class provider_test extends \core_privacy\tests\provider_testcase {
/**
* When no preference exists, there should be no export.
*/
@@ -85,7 +82,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array
*/
- public function data_filemanager_recentviewmode() {
+ public static function data_filemanager_recentviewmode(): array {
return [
'icons' => [
'val' => '1',
diff --git a/lib/mlbackend/python/tests/processor_test.php b/lib/mlbackend/python/tests/processor_test.php
index f15b97d469f..aae8c9d0bd3 100644
--- a/lib/mlbackend/python/tests/processor_test.php
+++ b/lib/mlbackend/python/tests/processor_test.php
@@ -23,9 +23,9 @@ namespace mlbackend_python;
* @category test
* @copyright 2019 David Mudrák
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @covers \mlbackend_python\processor
*/
-class processor_test extends \advanced_testcase {
-
+final class processor_test extends \advanced_testcase {
/**
* Test implementation of the {@link \mlbackend_python\processor::check_pip_package_version()} method.
*
@@ -42,10 +42,11 @@ class processor_test extends \advanced_testcase {
* Check that the {@link \mlbackend_python\processor::check_pip_package_version()} can be called with single argument.
*/
public function test_check_pip_package_version_default(): void {
-
$this->assertSame(-1, \mlbackend_python\processor::check_pip_package_version('0.0.1'));
- $this->assertSame(0, \mlbackend_python\processor::check_pip_package_version(
- \mlbackend_python\processor::REQUIRED_PIP_PACKAGE_VERSION));
+ $this->assertSame(
+ 0,
+ \mlbackend_python\processor::check_pip_package_version(\mlbackend_python\processor::REQUIRED_PIP_PACKAGE_VERSION),
+ );
}
/**
@@ -53,7 +54,7 @@ class processor_test extends \advanced_testcase {
*
* @return array
*/
- public function check_pip_package_versions() {
+ public static function check_pip_package_versions(): array {
return [
// Exact match.
[
diff --git a/lib/phpunit/classes/advanced_testcase.php b/lib/phpunit/classes/advanced_testcase.php
index 7f4d92c653d..aa7512f36df 100644
--- a/lib/phpunit/classes/advanced_testcase.php
+++ b/lib/phpunit/classes/advanced_testcase.php
@@ -191,7 +191,7 @@ abstract class advanced_testcase extends base_testcase {
* @param array $files full paths to CSV or XML files to load.
* @return phpunit_dataset
*/
- protected function dataset_from_files(array $files) {
+ protected static function dataset_from_files(array $files) {
// We ignore $delimiter, $enclosure and $escape, use the default ones in your fixtures.
$dataset = new phpunit_dataset();
$dataset->from_files($files);
@@ -208,7 +208,7 @@ abstract class advanced_testcase extends base_testcase {
* @param string $table name of the table which the file belongs to (only for CSV files).
* @return phpunit_dataset
*/
- protected function dataset_from_string(string $content, string $type, ?string $table = null) {
+ protected static function dataset_from_string(string $content, string $type, ?string $table = null) {
$dataset = new phpunit_dataset();
$dataset->from_string($content, $type, $table);
return $dataset;
@@ -222,7 +222,7 @@ abstract class advanced_testcase extends base_testcase {
* @param array $data array of tables, see {@see phpunit_dataset::from_array()} for supported formats.
* @return phpunit_dataset
*/
- protected function dataset_from_array(array $data) {
+ protected static function dataset_from_array(array $data) {
$dataset = new phpunit_dataset();
$dataset->from_array($data);
return $dataset;
@@ -607,28 +607,31 @@ abstract class advanced_testcase extends base_testcase {
* @param bool $https true if https required
* @return string url
*/
- public function getExternalTestFileUrl($path, $https = false) {
+ public static function getExternalTestFileUrl(
+ string $path,
+ bool $https = false,
+ ): string {
$path = ltrim($path, '/');
if ($path) {
- $path = '/' . $path;
+ $path = "/{$path}";
}
if ($https) {
if (defined('TEST_EXTERNAL_FILES_HTTPS_URL')) {
if (!TEST_EXTERNAL_FILES_HTTPS_URL) {
- $this->markTestSkipped('Tests using external https test files are disabled');
+ self::markTestSkipped('Tests using external https test files are disabled');
}
return TEST_EXTERNAL_FILES_HTTPS_URL . $path;
}
- return 'https://download.moodle.org/unittest' . $path;
+ return "https://download.moodle.org/unittest/{$path}";
}
if (defined('TEST_EXTERNAL_FILES_HTTP_URL')) {
if (!TEST_EXTERNAL_FILES_HTTP_URL) {
- $this->markTestSkipped('Tests using external http test files are disabled');
+ self::markTestSkipped('Tests using external http test files are disabled');
}
return TEST_EXTERNAL_FILES_HTTP_URL . $path;
}
- return 'http://download.moodle.org/unittest' . $path;
+ return "http://download.moodle.org/unittest/{$path}";
}
/**
@@ -845,17 +848,11 @@ abstract class advanced_testcase extends base_testcase {
string $component,
string $path,
): string {
- $fullpath = sprintf(
+ return sprintf(
"%s/tests/fixtures/%s",
\core_component::get_component_directory($component),
$path,
);
-
- if (!file_exists($fullpath)) {
- throw new \coding_exception("Fixture file not found: $fullpath");
- }
-
- return $fullpath;
}
/**
@@ -880,7 +877,13 @@ abstract class advanced_testcase extends base_testcase {
global $COURSE;
global $SITE;
- require_once(static::get_fixture_path($component, $path));
+ $fullpath = static::get_fixture_path($component, $path);
+
+ if (!file_exists($fullpath)) {
+ throw new \coding_exception("Fixture file not found: $fullpath");
+ }
+
+ require_once($fullpath);
}
/**
diff --git a/lib/phpunit/tests/phpunit_dataset_test.php b/lib/phpunit/tests/phpunit_dataset_test.php
index 56dc9a29cc0..de97805bfbb 100644
--- a/lib/phpunit/tests/phpunit_dataset_test.php
+++ b/lib/phpunit/tests/phpunit_dataset_test.php
@@ -80,7 +80,7 @@ class phpunit_dataset_test extends advanced_testcase {
/**
* test_from_file() data provider.
*/
- public function from_file_provider() {
+ public static function from_file_provider(): array {
// Create an unreadable file with vfsStream.
$vfsfile = vfsStream::newFile('unreadable', 0222);
vfsStream::setup('root')->addChild($vfsfile);
@@ -177,7 +177,7 @@ class phpunit_dataset_test extends advanced_testcase {
/**
* test_from_string() data provider.
*/
- public function from_string_provider() {
+ public static function from_string_provider(): array {
return [
'wrong type' => [
@@ -267,7 +267,7 @@ class phpunit_dataset_test extends advanced_testcase {
/**
* test_from_array() data provider.
*/
- public function from_array_provider() {
+ public static function from_array_provider(): array {
return [
'repeated array table many structures' => [
'structure' => [
@@ -413,7 +413,7 @@ class phpunit_dataset_test extends advanced_testcase {
/**
* test_load_csv() data provider.
*/
- public function load_csv_provider() {
+ public static function load_csv_provider(): array {
return [
'repeated csv table many files' => [
@@ -501,7 +501,7 @@ class phpunit_dataset_test extends advanced_testcase {
/**
* test_load_xml() data provider.
*/
- public function load_xml_provider() {
+ public static function load_xml_provider(): array {
return [
'repeated xml table multiple files' => [
@@ -669,7 +669,7 @@ class phpunit_dataset_test extends advanced_testcase {
/**
* test_to_database() data provider.
*/
- public function to_database_provider() {
+ public static function to_database_provider(): array {
return [
'wrong table requested' => [
@@ -824,7 +824,7 @@ class phpunit_dataset_test extends advanced_testcase {
/**
* test_get_rows() data provider.
*/
- public function get_rows_provider() {
+ public static function get_rows_provider(): array {
return [
'wrong table requested' => [
diff --git a/lib/phpunit/tests/util_test.php b/lib/phpunit/tests/util_test.php
index 5109333b9f8..c6f8d52d245 100644
--- a/lib/phpunit/tests/util_test.php
+++ b/lib/phpunit/tests/util_test.php
@@ -36,7 +36,7 @@ class util_test extends \advanced_testcase {
}
}
- public function set_table_modified_by_sql_provider() {
+ public static function set_table_modified_by_sql_provider(): array {
global $DB;
$prefix = $DB->get_prefix();
diff --git a/lib/table/tests/local/filter/filter_test.php b/lib/table/tests/local/filter/filter_test.php
index 1b37f312894..0f93aada468 100644
--- a/lib/table/tests/local/filter/filter_test.php
+++ b/lib/table/tests/local/filter/filter_test.php
@@ -57,7 +57,7 @@ class filter_test extends advanced_testcase {
*
* @return array
*/
- public function constructor_provider(): array {
+ public static function constructor_provider(): array {
return [
'Name without values' => [['keyword'], filter::JOINTYPE_DEFAULT, []],
'Name with valid join type ANY' => [[
@@ -147,7 +147,7 @@ class filter_test extends advanced_testcase {
*
* @return array
*/
- public function constructor_invalid_join_provider(): array {
+ public static function constructor_invalid_join_provider(): array {
return [
'Too low' => [-1],
'Too high' => [4],
@@ -255,7 +255,7 @@ class filter_test extends advanced_testcase {
*
* @return array
*/
- public function filter_value_provider(): array {
+ public static function filter_value_provider(): array {
return [
'Empty' => [[], 0],
'Single value' => [[10], 1],
diff --git a/lib/table/tests/local/filter/integer_filter_test.php b/lib/table/tests/local/filter/integer_filter_test.php
index caf0027155b..a42f873a725 100644
--- a/lib/table/tests/local/filter/integer_filter_test.php
+++ b/lib/table/tests/local/filter/integer_filter_test.php
@@ -91,7 +91,7 @@ class integer_filter_test extends advanced_testcase {
*
* @return array
*/
- public function add_filter_value_invalid_types_provider(): array {
+ public static function add_filter_value_invalid_types_provider(): array {
return [
'Null' => [null, 'NULL'],
'Empty string' => ['', 'string'],
diff --git a/lib/table/tests/local/filter/numeric_comparison_filter_test.php b/lib/table/tests/local/filter/numeric_comparison_filter_test.php
index af8ac564056..876bb5746ec 100644
--- a/lib/table/tests/local/filter/numeric_comparison_filter_test.php
+++ b/lib/table/tests/local/filter/numeric_comparison_filter_test.php
@@ -117,7 +117,7 @@ class numeric_comparison_filter_test extends advanced_testcase {
*
* @return array
*/
- public function add_filter_value_invalid_types_provider(): array {
+ public static function add_filter_value_invalid_types_provider(): array {
return [
'Null' => [
[null],
diff --git a/lib/table/tests/local/filter/string_filter_test.php b/lib/table/tests/local/filter/string_filter_test.php
index 7a092bb80e0..ecc3e587084 100644
--- a/lib/table/tests/local/filter/string_filter_test.php
+++ b/lib/table/tests/local/filter/string_filter_test.php
@@ -91,7 +91,7 @@ class string_filter_test extends advanced_testcase {
*
* @return array
*/
- public function add_filter_value_invalid_types_provider(): array {
+ public static function add_filter_value_invalid_types_provider(): array {
return [
'Null' => [null, 'NULL'],
'1' => [1, 'integer'],
diff --git a/lib/table/tests/tablelib_test.php b/lib/table/tests/tablelib_test.php
index a3c800a3484..bd32df71be3 100644
--- a/lib/table/tests/tablelib_test.php
+++ b/lib/table/tests/tablelib_test.php
@@ -363,7 +363,7 @@ class tablelib_test extends \advanced_testcase {
*
* @return array
*/
- public function fullname_column_provider() {
+ public static function fullname_column_provider(): array {
return [
['language'],
['alternatename lastname'],
@@ -782,7 +782,7 @@ class tablelib_test extends \advanced_testcase {
*
* @return array
*/
- public function initials_provider(): array {
+ public static function initials_provider(): array {
return [
[null, null, null],
['A', null, 'A'],
diff --git a/lib/tests/accesslib_has_capability_test.php b/lib/tests/accesslib_has_capability_test.php
index b63210c375d..69b0c2a1938 100644
--- a/lib/tests/accesslib_has_capability_test.php
+++ b/lib/tests/accesslib_has_capability_test.php
@@ -364,7 +364,7 @@ class accesslib_has_capability_test extends \advanced_testcase {
*
* @return array
*/
- public function locked_context_provider() {
+ public static function locked_context_provider(): array {
return [
'All unlocked' => [
'locked' => [
@@ -447,7 +447,7 @@ class accesslib_has_capability_test extends \advanced_testcase {
*
* @return array
*/
- public function login_as_provider(): array {
+ public static function login_as_provider(): array {
return [
[
'system',
diff --git a/lib/tests/accesslib_test.php b/lib/tests/accesslib_test.php
index a533bbe5289..b26db9a4a96 100644
--- a/lib/tests/accesslib_test.php
+++ b/lib/tests/accesslib_test.php
@@ -2070,7 +2070,7 @@ class accesslib_test extends advanced_testcase {
*
* @return array
*/
- public function deprecated_capabilities_use_cases() {
+ public static function deprecated_capabilities_use_cases(): array {
return [
'capability missing' => [
'fake/access:missingcapability',
@@ -3076,7 +3076,7 @@ class accesslib_test extends advanced_testcase {
$this->assertEquals(1, count_enrolled_users($coursecontext, '', $groupids));
}
- public function get_enrolled_sql_provider() {
+ public static function get_enrolled_sql_provider(): array {
return array(
array(
// Two users who are enrolled.
@@ -4619,7 +4619,7 @@ class accesslib_test extends advanced_testcase {
*
* @return array
*/
- public function get_get_with_capability_join_override_cases() {
+ public static function get_get_with_capability_join_override_cases(): array {
return [
'no overrides' => [true, []],
'one override' => [true, ['moodle/course:viewscales']],
@@ -4821,7 +4821,7 @@ class accesslib_test extends advanced_testcase {
*
* @return array
*/
- public function is_parent_of_provider(): array {
+ public static function is_parent_of_provider(): array {
$provideboth = function(string $desc, string $contextpath, string $testpath, bool $expected): array {
return [
"includeself: true; {$desc}" => [
@@ -4922,7 +4922,7 @@ class accesslib_test extends advanced_testcase {
*
* @return array
*/
- public function is_child_of_provider(): array {
+ public static function is_child_of_provider(): array {
$provideboth = function(string $desc, string $contextpath, string $testpath, bool $expected): array {
return [
"includeself: true; {$desc}" => [
diff --git a/lib/tests/adminlib_test.php b/lib/tests/adminlib_test.php
index 9562011e0a6..e9686746b2d 100644
--- a/lib/tests/adminlib_test.php
+++ b/lib/tests/adminlib_test.php
@@ -35,7 +35,7 @@ class adminlib_test extends \advanced_testcase {
*
* @return array
*/
- public function db_should_replace_dataprovider() {
+ public static function db_should_replace_dataprovider(): array {
return [
// Skipped tables.
['block_instances', '', false],
@@ -86,7 +86,7 @@ class adminlib_test extends \advanced_testcase {
* @covers ::db_should_replace
* @return array
*/
- public function db_should_replace_additional_skip_tables_dataprovider() {
+ public static function db_should_replace_additional_skip_tables_dataprovider(): array {
return [
// Skipped tables.
['block_instances', '', false],
diff --git a/lib/tests/behat_lib_test.php b/lib/tests/behat_lib_test.php
index 8c5dd972c42..e3fe88d8e89 100644
--- a/lib/tests/behat_lib_test.php
+++ b/lib/tests/behat_lib_test.php
@@ -78,7 +78,7 @@ class behat_lib_test extends advanced_testcase {
*
* @return array Array of values to test behat_is_requested_url() function.
*/
- public function url_provider() {
+ public static function url_provider(): array {
return [
// Tests for common ports.
['http://behat.moodle.org', true, ['behat.moodle.org', 80, '']],
diff --git a/lib/tests/client_test.php b/lib/tests/client_test.php
index d3d1b3020b8..22a71e0e708 100644
--- a/lib/tests/client_test.php
+++ b/lib/tests/client_test.php
@@ -29,7 +29,7 @@ class client_test extends advanced_testcase {
*
* @return array
*/
- public function map_response_provider(): array {
+ public static function map_response_provider(): array {
return [
"Nested objects syntax a-b-c syntax " => [
[
diff --git a/lib/tests/completionlib_test.php b/lib/tests/completionlib_test.php
index 22aaf6da228..3428e9e7bc8 100644
--- a/lib/tests/completionlib_test.php
+++ b/lib/tests/completionlib_test.php
@@ -354,7 +354,7 @@ class completionlib_test extends advanced_testcase {
*
* @return array[]
*/
- public function internal_get_state_provider() {
+ public static function internal_get_state_provider(): array {
return [
'View required, but not viewed yet' => [
COMPLETION_VIEW_REQUIRED, 1, '', COMPLETION_INCOMPLETE
@@ -415,7 +415,7 @@ class completionlib_test extends advanced_testcase {
*
* @return array
*/
- public function internal_get_state_with_grade_criteria_provider() {
+ public static function internal_get_state_with_grade_criteria_provider(): array {
return [
"Passing grade enabled and achieve. State should be COMPLETION_COMPLETE_PASS" => [
[
@@ -737,7 +737,7 @@ class completionlib_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_data_provider() {
+ public static function get_data_provider(): array {
return [
'No completion record' => [
false, true, false, COMPLETION_INCOMPLETE
@@ -1647,7 +1647,7 @@ class completionlib_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_grade_completion_provider() {
+ public static function get_grade_completion_provider(): array {
return [
'Grade not required' => [false, false, null, null, null],
'Grade required, but has no grade yet' => [true, false, null, null, COMPLETION_INCOMPLETE],
diff --git a/lib/tests/configonlylib_test.php b/lib/tests/configonlylib_test.php
index 0d13174c172..43752843d35 100644
--- a/lib/tests/configonlylib_test.php
+++ b/lib/tests/configonlylib_test.php
@@ -186,7 +186,7 @@ class configonlylib_test extends \advanced_testcase {
*
* @return array
*/
- public function min_is_revision_valid_and_current_provider(): array {
+ public static function min_is_revision_valid_and_current_provider(): array {
return [
'Negative value' => [-1, false],
'Empty value' => [0, false],
diff --git a/lib/tests/core_renderer_template_exploit_test.php b/lib/tests/core_renderer_template_exploit_test.php
index 6b6173dfb3f..f2d3bc09881 100644
--- a/lib/tests/core_renderer_template_exploit_test.php
+++ b/lib/tests/core_renderer_template_exploit_test.php
@@ -30,7 +30,7 @@ class core_renderer_template_exploit_test extends \advanced_testcase {
* text by the helper before being passed to other another helper. This prevents
* nested calls to helpers.
*/
- public function get_template_testcases() {
+ public static function get_template_testcases(): array {
// Different helper implementations to test various combinations of nested
// calls to render the templates.
$norender = function($text) {
@@ -387,7 +387,7 @@ class core_renderer_template_exploit_test extends \advanced_testcase {
/**
* Test that the mustache_helper_collection class correctly strips
- * @dataProvider get_template_testcases()
+ * @dataProvider get_template_testcases
* @param array $templates The template to add
* @param string $torender The name of the template to render
* @param array $context The template context
diff --git a/lib/tests/curl_security_helper_test.php b/lib/tests/curl_security_helper_test.php
index 568ff290d9f..84834b7536e 100644
--- a/lib/tests/curl_security_helper_test.php
+++ b/lib/tests/curl_security_helper_test.php
@@ -62,7 +62,7 @@ class curl_security_helper_test extends \advanced_testcase {
*
* @return array
*/
- public function curl_security_url_data_provider() {
+ public static function curl_security_url_data_provider(): array {
$simpledns = ['localhost' => ['127.0.0.1']];
$multiplerecorddns = [
'sub.example.com' => ['1.2.3.4', '5.6.7.8']
@@ -180,7 +180,7 @@ class curl_security_helper_test extends \advanced_testcase {
*
* @return array
*/
- public function curl_security_settings_data_provider() {
+ public static function curl_security_settings_data_provider(): array {
// Format: blocked hosts, allowed ports, expected result.
return [
["", "", false],
@@ -212,7 +212,7 @@ class curl_security_helper_test extends \advanced_testcase {
*
* @return array
*/
- public function curl_security_host_data_provider() {
+ public static function curl_security_host_data_provider(): array {
return [
// IPv4 hosts.
["127.0.0.1", "127.0.0.1", true],
@@ -266,7 +266,7 @@ class curl_security_helper_test extends \advanced_testcase {
*
* @return array
*/
- public function curl_security_port_data_provider() {
+ public static function curl_security_port_data_provider(): array {
return [
["", "80\n443", true],
[" ", "80\n443", true],
diff --git a/lib/tests/datalib_test.php b/lib/tests/datalib_test.php
index 77b03dc8a4c..19ef2c8bf0b 100644
--- a/lib/tests/datalib_test.php
+++ b/lib/tests/datalib_test.php
@@ -906,7 +906,7 @@ class datalib_test extends \advanced_testcase {
*
* @return array
*/
- public function get_safe_orderby_provider(): array {
+ public static function get_safe_orderby_provider(): array {
$orderbymap = [
'courseid' => 'c.id',
'somecustomvalue' => 'c.startdate, c.shortname',
@@ -994,7 +994,7 @@ class datalib_test extends \advanced_testcase {
*
* @return array
*/
- public function get_safe_orderby_multiple_provider(): array {
+ public static function get_safe_orderby_multiple_provider(): array {
$orderbymap = [
'courseid' => 'c.id',
'firstname' => 'u.firstname',
diff --git a/lib/tests/date_test.php b/lib/tests/date_test.php
index 99405ee69e1..cc1fbb5193d 100644
--- a/lib/tests/date_test.php
+++ b/lib/tests/date_test.php
@@ -386,7 +386,7 @@ class date_test extends advanced_testcase {
$this->assertSame('Etc/GMT-1', date_default_timezone_get());
}
- public function legacyUserTimezoneProvider() {
+ public static function legacyUserTimezoneProvider(): array {
return [
['', 'Australia/Perth'], // Fallback on default timezone.
['-13.0', 'Australia/Perth'], // Fallback on default timezone.
diff --git a/lib/tests/encryption_test.php b/lib/tests/encryption_test.php
index 54d2355d2c0..a96ea26c273 100644
--- a/lib/tests/encryption_test.php
+++ b/lib/tests/encryption_test.php
@@ -58,7 +58,7 @@ class encryption_test extends advanced_testcase {
*
* @return array[] Array of method options for test
*/
- public function encryption_method_provider(): array {
+ public static function encryption_method_provider(): array {
return [
'Sodium' => [encryption::METHOD_SODIUM],
];
diff --git a/lib/tests/external/moodlenet_send_activity_test.php b/lib/tests/external/moodlenet_send_activity_test.php
index 02ca05fee99..57753e8425c 100644
--- a/lib/tests/external/moodlenet_send_activity_test.php
+++ b/lib/tests/external/moodlenet_send_activity_test.php
@@ -140,7 +140,7 @@ class moodlenet_send_activity_test extends externallib_advanced_testcase {
*
* @return array Test data.
*/
- public function return_resource_url_provider(): array {
+ public static function return_resource_url_provider(): array {
return [
'Success 1' => [
true,
diff --git a/lib/tests/external/moodlenet_send_course_test.php b/lib/tests/external/moodlenet_send_course_test.php
index f622ab3c957..ff622bf65cb 100644
--- a/lib/tests/external/moodlenet_send_course_test.php
+++ b/lib/tests/external/moodlenet_send_course_test.php
@@ -146,7 +146,7 @@ class moodlenet_send_course_test extends externallib_advanced_testcase {
*
* @return array Test data.
*/
- public function return_resource_url_provider(): array {
+ public static function return_resource_url_provider(): array {
return [
'Success 1' => [
true,
diff --git a/lib/tests/external/output/icon_system/load_fontawesome_map_test.php b/lib/tests/external/output/icon_system/load_fontawesome_map_test.php
index eb644c57c8b..a0916625f83 100644
--- a/lib/tests/external/output/icon_system/load_fontawesome_map_test.php
+++ b/lib/tests/external/output/icon_system/load_fontawesome_map_test.php
@@ -77,7 +77,7 @@ class load_fontawesome_map_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function valid_fontawesome_theme_provider(): array {
+ public static function valid_fontawesome_theme_provider(): array {
return [
'Boost theme' => ['boost'],
'Classic theme (extends boost)' => ['classic'],
diff --git a/lib/tests/external/record_userfeedback_action_test.php b/lib/tests/external/record_userfeedback_action_test.php
index 22e454c4518..cb6a9b2dc3d 100644
--- a/lib/tests/external/record_userfeedback_action_test.php
+++ b/lib/tests/external/record_userfeedback_action_test.php
@@ -48,7 +48,7 @@ class record_userfeedback_action_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function record_userfeedback_action_provider() {
+ public static function record_userfeedback_action_provider(): array {
return [
'give action' => ['give'],
'remind action' => ['remind'],
diff --git a/lib/tests/filestorage_zip_archive_test.php b/lib/tests/filestorage_zip_archive_test.php
index db83e8111b9..6679cefa118 100644
--- a/lib/tests/filestorage_zip_archive_test.php
+++ b/lib/tests/filestorage_zip_archive_test.php
@@ -54,7 +54,7 @@ class filestorage_zip_archive_test extends \advanced_testcase {
*
* @return array Array of tested pathnames and expected results.
*/
- public function pathname_provider() {
+ public static function pathname_provider(): array {
return [
// Test a string.
['my file.pdf', 'my file.pdf'],
diff --git a/lib/tests/gradelib_test.php b/lib/tests/gradelib_test.php
index a00947e5097..53b5ede3a91 100644
--- a/lib/tests/gradelib_test.php
+++ b/lib/tests/gradelib_test.php
@@ -188,7 +188,7 @@ class gradelib_test extends \advanced_testcase {
*
* @return array
*/
- public function grade_get_date_for_user_grade_provider(): array {
+ public static function grade_get_date_for_user_grade_provider(): array {
$u1 = (object) [
'id' => 42,
];
diff --git a/lib/tests/graphlib_test.php b/lib/tests/graphlib_test.php
index cf8cb55eb86..fcd15fd42fd 100644
--- a/lib/tests/graphlib_test.php
+++ b/lib/tests/graphlib_test.php
@@ -36,7 +36,7 @@ class graphlib_test extends \basic_testcase {
*
* @return array
*/
- public function create_data(): array {
+ public static function create_data(): array {
return [
'data' =>
[
diff --git a/lib/tests/htmlpurifier_test.php b/lib/tests/htmlpurifier_test.php
index 828fa0037ad..004614316c3 100644
--- a/lib/tests/htmlpurifier_test.php
+++ b/lib/tests/htmlpurifier_test.php
@@ -353,7 +353,7 @@ class htmlpurifier_test extends \basic_testcase {
/**
* Test cases for the test_media_tags test.
*/
- public function media_tags_provider() {
+ public static function media_tags_provider(): array {
// Takes an array of attributes, then generates a test for each of them.
$generatetestcases = function($prefix, array $attrs, array $templates) {
return array_reduce($attrs, function($carry, $attr) use ($prefix, $templates) {
diff --git a/lib/tests/ip_utils_test.php b/lib/tests/ip_utils_test.php
index 967ed2f12b5..ac7a89592ab 100644
--- a/lib/tests/ip_utils_test.php
+++ b/lib/tests/ip_utils_test.php
@@ -41,7 +41,7 @@ class ip_utils_test extends \basic_testcase {
*
* @return array
*/
- public function domain_name_data_provider() {
+ public static function domain_name_data_provider(): array {
return [
["com", true],
["i.net", true], // Single char, alpha tertiary domain.
@@ -91,7 +91,7 @@ class ip_utils_test extends \basic_testcase {
*
* @return array
*/
- public function domain_matching_patterns_data_provider() {
+ public static function domain_matching_patterns_data_provider(): array {
return [
["*.com", true],
["*.example.com", true],
@@ -136,7 +136,7 @@ class ip_utils_test extends \basic_testcase {
*
* @return array
*/
- public function ip_address_data_provider() {
+ public static function ip_address_data_provider(): array {
return [
["127.0.0.1", true],
["10.1", false],
@@ -183,7 +183,7 @@ class ip_utils_test extends \basic_testcase {
*
* @return array
*/
- public function ipv4_address_data_provider() {
+ public static function ipv4_address_data_provider(): array {
return [
["127.0.0.1", true],
["0.0.0.0", true],
@@ -219,7 +219,7 @@ class ip_utils_test extends \basic_testcase {
*
* @return array
*/
- public function ipv4_range_data_provider() {
+ public static function ipv4_range_data_provider(): array {
return [
["127.0.0.1/24", true],
["127.0.0.20-20", true],
@@ -260,7 +260,7 @@ class ip_utils_test extends \basic_testcase {
*
* @return array
*/
- public function ipv6_address_data_provider() {
+ public static function ipv6_address_data_provider(): array {
return [
["::", true],
["::0", true],
@@ -300,7 +300,7 @@ class ip_utils_test extends \basic_testcase {
*
* @return array
*/
- public function ipv6_range_data_provider() {
+ public static function ipv6_range_data_provider(): array {
return [
["::/128", true],
["::1/128", true],
@@ -352,7 +352,7 @@ class ip_utils_test extends \basic_testcase {
*
* @return array
*/
- public function data_domain_addresses() {
+ public static function data_domain_addresses(): array {
return [
[true, 'example.com'],
[true, 'ExAmPle.com'],
@@ -378,7 +378,7 @@ class ip_utils_test extends \basic_testcase {
*
* @return array
*/
- public function data_is_ip_in_subnet_list() {
+ public static function data_is_ip_in_subnet_list(): array {
return [
[true, '1.1.1.1', '1.1.1.1', "\n"],
[false, '1.1.1.1', '2.2.2.2', "\n"],
diff --git a/lib/tests/ldaplib_test.php b/lib/tests/ldaplib_test.php
index 67dc8cf738d..4bcd4a65cb7 100644
--- a/lib/tests/ldaplib_test.php
+++ b/lib/tests/ldaplib_test.php
@@ -184,7 +184,7 @@ class ldaplib_test extends \advanced_testcase {
*
* @return array of testcases.
*/
- public function ldap_normalise_objectclass_provider() {
+ public static function ldap_normalise_objectclass_provider(): array {
return array(
'Empty value' => array(
array(null),
diff --git a/lib/tests/modinfolib_test.php b/lib/tests/modinfolib_test.php
index d2ecf1b6d12..3bdb5effa9c 100644
--- a/lib/tests/modinfolib_test.php
+++ b/lib/tests/modinfolib_test.php
@@ -1176,7 +1176,7 @@ class modinfolib_test extends advanced_testcase {
*
* @return array
*/
- public function get_section_info_by_id_provider() {
+ public static function get_section_info_by_id_provider(): array {
return [
'Valid section id' => [
'sectionnum' => 1,
diff --git a/lib/tests/moodle_page_test.php b/lib/tests/moodle_page_test.php
index a8d6265c315..277d00596bc 100644
--- a/lib/tests/moodle_page_test.php
+++ b/lib/tests/moodle_page_test.php
@@ -334,7 +334,7 @@ class moodle_page_test extends \advanced_testcase {
*
* @return array
*/
- public function set_title_provider(): array {
+ public static function set_title_provider(): array {
return [
'Do not append the site name' => [
'shortname', false, '', false
@@ -784,7 +784,7 @@ class moodle_page_test extends \advanced_testcase {
*
* @return array
*/
- public function get_user_theme_provider() {
+ public static function get_user_theme_provider(): array {
return [
'User not a member of any cohort' => [
'usertheme' => '',
diff --git a/lib/tests/moodlelib_test.php b/lib/tests/moodlelib_test.php
index 45b4f7c0b33..f41ab281ff3 100644
--- a/lib/tests/moodlelib_test.php
+++ b/lib/tests/moodlelib_test.php
@@ -1104,7 +1104,7 @@ final class moodlelib_test extends \advanced_testcase {
*
* @return array of ($filename, $length, $expected, $includehash)
*/
- public function shorten_filename_provider() {
+ public static function shorten_filename_provider(): array {
$filename = 'sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium totam rem';
$shortfilename = 'sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque';
@@ -1207,7 +1207,7 @@ final class moodlelib_test extends \advanced_testcase {
*
* @return array of ($filename, $length, $expected, $includehash)
*/
- public function shorten_filenames_provider() {
+ public static function shorten_filenames_provider(): array {
$shortfilename = 'sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque';
$longfilename = 'sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium totam rem';
$extfilename = $longfilename.'.zip';
@@ -3211,7 +3211,7 @@ EOF;
/**
* A data provider for testing email messageid
*/
- public function generate_email_messageid_provider() {
+ public static function generate_email_messageid_provider(): array {
return array(
'nopath' => array(
'wwwroot' => 'http://www.example.com',
@@ -3278,7 +3278,7 @@ EOF;
/**
* A data provider for testing email diversion
*/
- public function diverted_emails_provider() {
+ public static function diverted_emails_provider(): array {
return array(
'nodiverts' => array(
'divertallemailsto' => null,
@@ -3485,7 +3485,7 @@ EOF;
*
* @return array
*/
- public function email_to_user_attachment_provider(): array {
+ public static function email_to_user_attachment_provider(): array {
global $CFG;
// Return all paths that can be used to send attachments from.
@@ -3858,7 +3858,7 @@ EOF;
*
* @return array of test cases.
*/
- public function count_words_testcases(): array {
+ public static function count_words_testcases(): array {
// Copy-pasting example from MDL-64240.
$copypasted = <<Snoot is booped
@@ -3933,7 +3933,7 @@ EOT;
*
* @return array of test cases.
*/
- public function count_letters_testcases(): array {
+ public static function count_letters_testcases(): array {
return [
[0, ''],
[1, 'x'],
@@ -4098,7 +4098,7 @@ EOT;
/**
* Data provider for private ips.
*/
- public function data_private_ips() {
+ public static function data_private_ips(): array {
return array(
array('10.0.0.0'),
array('172.16.0.0'),
@@ -4123,7 +4123,7 @@ EOT;
/**
* Data provider for public ips.
*/
- public function data_public_ips() {
+ public static function data_public_ips(): array {
return array(
array('2400:cb00:2048:1::8d65:71b3'),
array('2400:6180:0:d0::1b:2001'),
@@ -4176,7 +4176,7 @@ EOT;
*
* @return array Returns an array of test data for the above function.
*/
- public function data_can_send_from_real_email_address() {
+ public static function data_can_send_from_real_email_address(): array {
return [
// Test from email is in allowed domain.
// Test that from display is set to show no one.
@@ -4322,7 +4322,7 @@ EOT;
*
* @return array Returns an array of test data for the above function.
*/
- public function data_email_is_not_allowed_for_allowemailaddresses() {
+ public static function data_email_is_not_allowed_for_allowemailaddresses(): array {
return [
// Test allowed domain empty list.
[
@@ -4401,7 +4401,7 @@ EOT;
*
* @return array Returns an array of test data for the above function.
*/
- public function data_email_is_not_allowed_for_denyemailaddresses() {
+ public static function data_email_is_not_allowed_for_denyemailaddresses(): array {
return [
// Test denied domain empty list.
[
@@ -4579,7 +4579,7 @@ EOT;
*
* @return array
*/
- public function component_class_callback_default_provider() {
+ public static function component_class_callback_default_provider(): array {
return [
'null' => [null],
'empty string' => [''],
@@ -4595,7 +4595,7 @@ EOT;
*
* @return array
*/
- public function component_class_callback_data_provider() {
+ public static function component_class_callback_data_provider(): array {
return [
'empty string' => [''],
'string' => ['This is a string'],
@@ -4610,7 +4610,7 @@ EOT;
*
* @return array
*/
- public function component_class_callback_multiple_params_provider() {
+ public static function component_class_callback_multiple_params_provider(): array {
return [
'empty array' => [
[],
@@ -4655,7 +4655,7 @@ EOT;
*
* @return array of (string)case => [(mixed)callable, (string|bool)expected description]
*/
- public function callable_names_provider() {
+ public static function callable_names_provider(): array {
return [
'integer' => [
386,
@@ -4673,10 +4673,6 @@ EOT;
['my_foobar_class', 'my_foobar_method'],
'my_foobar_class::my_foobar_method',
],
- 'static_method_of_object' => [
- [$this, 'my_foobar_method'],
- 'core\moodlelib_test::my_foobar_method',
- ],
'method_of_object' => [
[new lang_string('parentlanguage', 'core_langconfig'), 'my_foobar_method'],
'core\lang_string::my_foobar_method',
@@ -4692,12 +4688,19 @@ EOT;
];
}
+ /**
+ * Test that get_callable_name works with a static method on an instance.
+ */
+ public function test_get_callable_name_this(): void {
+ $this->assertSame('core\moodlelib_test::foo', get_callable_name([$this, 'foo']));
+ }
+
/**
* Data provider for \core_moodlelib_testcase::test_get_complete_user_data().
*
* @return array
*/
- public function user_data_provider() {
+ public static function user_data_provider(): array {
return [
'Fetch data using a valid username' => [
'username', 's1', true
@@ -4832,7 +4835,7 @@ EOT;
/**
* Data provider for the test_get_time_interval_string() method.
*/
- public function get_time_interval_string_provider() {
+ public static function get_time_interval_string_provider(): array {
return [
'Time is after the reference time by 1 minute, omitted format' => [
'time1' => 12345660,
@@ -4990,7 +4993,7 @@ EOT;
*
* @return array of ($size, $expected)
*/
- public function display_size_provider() {
+ public static function display_size_provider(): array {
return [
[0, '0 bytes'],
@@ -5032,7 +5035,7 @@ EOT;
*
* @return array of ($size, $units, $expected)
*/
- public function display_size_fixed_provider(): array {
+ public static function display_size_fixed_provider(): array {
return [
[0, 'KB', '0.0 KB'],
[1, 'MB', '0.0 MB'],
@@ -5062,7 +5065,7 @@ EOT;
*
* @return array of ($size, $decimalplaces, $units, $expected)
*/
- public function display_size_dp_provider(): array {
+ public static function display_size_dp_provider(): array {
return [
[0, 1, 'KB', '0.0 KB'],
[1, 6, 'MB', '0.000001 MB'],
@@ -5108,7 +5111,7 @@ EOT;
*
* @return array
*/
- public function get_list_of_plugins_provider(): array {
+ public static function get_list_of_plugins_provider(): array {
return [
'Standard excludes' => [
['amdd', 'class', 'local', 'test'],
@@ -5481,7 +5484,7 @@ EOT;
*
* @return array of test cases.
*/
- public function is_proxybypass_provider(): array {
+ public static function is_proxybypass_provider(): array {
return [
'Proxybypass contains the same IP as the beginning of the URL' => [
diff --git a/lib/tests/moodlenet/activity_sender_test.php b/lib/tests/moodlenet/activity_sender_test.php
index 352d847f243..e24bdf37b28 100644
--- a/lib/tests/moodlenet/activity_sender_test.php
+++ b/lib/tests/moodlenet/activity_sender_test.php
@@ -255,7 +255,7 @@ The last word of this sentence is in bold', $processeddescription);
*
* @return array Test data.
*/
- public function share_resource_provider(): array {
+ public static function share_resource_provider(): array {
return [
'Success' => [
'http_response' => new Response(
diff --git a/lib/tests/moodlenet/course_partial_sender_test.php b/lib/tests/moodlenet/course_partial_sender_test.php
index 271720e0520..12b5dc915ab 100644
--- a/lib/tests/moodlenet/course_partial_sender_test.php
+++ b/lib/tests/moodlenet/course_partial_sender_test.php
@@ -255,7 +255,7 @@ The last word of this sentence is in bold', $processeddescription);
*
* @return array Test data.
*/
- public function share_resource_provider(): array {
+ public static function share_resource_provider(): array {
return [
'Success' => [
'http_response' => new Response(
diff --git a/lib/tests/moodlenet/course_sender_test.php b/lib/tests/moodlenet/course_sender_test.php
index c6a9739be97..ec5d4a62011 100644
--- a/lib/tests/moodlenet/course_sender_test.php
+++ b/lib/tests/moodlenet/course_sender_test.php
@@ -259,7 +259,7 @@ The last word of this sentence is in bold', $processeddescription);
*
* @return array Test data.
*/
- public function share_resource_provider(): array {
+ public static function share_resource_provider(): array {
return [
'Success' => [
'http_response' => new Response(
diff --git a/lib/tests/myprofilelib_test.php b/lib/tests/myprofilelib_test.php
index 95f58c43aa0..9e2afa5035f 100644
--- a/lib/tests/myprofilelib_test.php
+++ b/lib/tests/myprofilelib_test.php
@@ -226,7 +226,7 @@ class myprofilelib_test extends \advanced_testcase {
*
* @return array[]
*/
- public function core_myprofile_navigation_contact_timezone_provider(): array {
+ public static function core_myprofile_navigation_contact_timezone_provider(): array {
return [
'Hidden field' => ['timezone', '99', '99', null],
'Forced timezone' => ['', 'Europe/London', 'Pacific/Tahiti', 'Europe/London'],
diff --git a/lib/tests/navigation/output/primary_test.php b/lib/tests/navigation/output/primary_test.php
index bf87e0e0269..e6f31868d90 100644
--- a/lib/tests/navigation/output/primary_test.php
+++ b/lib/tests/navigation/output/primary_test.php
@@ -114,7 +114,7 @@ class primary_test extends \advanced_testcase {
*
* @return array
*/
- public function primary_export_provider(): array {
+ public static function primary_export_provider(): array {
return [
"Export the menu data when: custom menu exists; multiple langs installed; user is not logged in." => [
true, true, '', ['mobileprimarynav', 'moremenu', 'lang', 'user']
@@ -190,7 +190,7 @@ class primary_test extends \advanced_testcase {
*
* @return array
*/
- public function custom_menu_provider(): array {
+ public static function custom_menu_provider(): array {
return [
'Simple custom menu' => [
"Course search|/course/search.php
diff --git a/lib/tests/navigation/views/primary_test.php b/lib/tests/navigation/views/primary_test.php
index 04647bc8188..5db7e0dbfc0 100644
--- a/lib/tests/navigation/views/primary_test.php
+++ b/lib/tests/navigation/views/primary_test.php
@@ -59,7 +59,7 @@ class primary_test extends \advanced_testcase {
/**
* Data provider for the test_setting_initialise function
*/
- public function setting_initialise_provider() {
+ public static function setting_initialise_provider(): array {
return [
'Testing as a guest user' => ['guest', ['home']],
'Testing as an admin' => ['admin', ['home', 'myhome', 'mycourses', 'siteadminnode']],
@@ -152,7 +152,7 @@ class primary_test extends \advanced_testcase {
*
* @return array
*/
- public function search_and_set_active_node_provider(): array {
+ public static function search_and_set_active_node_provider(): array {
return [
'Test by activating node which is part of the tree'
=> ['tenthchild', 'tenthchild'],
diff --git a/lib/tests/navigation/views/secondary_test.php b/lib/tests/navigation/views/secondary_test.php
index 21cae6d1100..dc9089b9f2c 100644
--- a/lib/tests/navigation/views/secondary_test.php
+++ b/lib/tests/navigation/views/secondary_test.php
@@ -73,7 +73,7 @@ class secondary_test extends \advanced_testcase {
* Data provider for test_get_leaf_nodes
* @return array
*/
- public function leaf_nodes_order_provider(): array {
+ public static function leaf_nodes_order_provider(): array {
return [
'Initialise the order with whole numbers' => [3, 2, 1],
'Initialise the order with a mix of whole and float numbers' => [2.1, 2, 1],
@@ -139,7 +139,7 @@ class secondary_test extends \advanced_testcase {
* Data provider for the test_setting_initialise function
* @return array
*/
- public function setting_initialise_provider(): array {
+ public static function setting_initialise_provider(): array {
return [
'Testing in a course context' => ['course', 'coursehome', 'courseheader', 'Course'],
'Testing in a course context using a single activity course format' =>
@@ -231,7 +231,7 @@ class secondary_test extends \advanced_testcase {
*
* @return array
*/
- public function active_node_scan_provider(): array {
+ public static function active_node_scan_provider(): array {
return [
'Test by activating node adjacent to root node'
=> ['firstchild', 'firstchild'],
@@ -289,7 +289,7 @@ class secondary_test extends \advanced_testcase {
*
* @return array
*/
- public function force_nodes_into_more_menu_provider(): array {
+ public static function force_nodes_into_more_menu_provider(): array {
return [
'The total number of navigation nodes exceeds the max display limit (5); ' .
'navnode2 and navnode4 are forced into "more" menu by default.' =>
@@ -472,7 +472,7 @@ class secondary_test extends \advanced_testcase {
*
* @return \string[][]
*/
- public function nodes_match_current_url_provider(): array {
+ public static function nodes_match_current_url_provider(): array {
return [
"Match url to a node that is a deep nested" => [
'/view/course.php',
@@ -530,7 +530,7 @@ class secondary_test extends \advanced_testcase {
*
* @return array[]
*/
- public function get_menu_array_provider(): array {
+ public static function get_menu_array_provider(): array {
return [
"Fetch information from a node with action and no children" => [
'child1',
@@ -635,7 +635,7 @@ class secondary_test extends \advanced_testcase {
*
* @return array
*/
- public function get_node_with_first_action_provider(): array {
+ public static function get_node_with_first_action_provider(): array {
return [
"Search for action when parent has no action and multiple children with actions" => [
"child3",
@@ -694,7 +694,7 @@ class secondary_test extends \advanced_testcase {
*
* @return array
*/
- public function add_external_nodes_to_secondary_provider() {
+ public static function add_external_nodes_to_secondary_provider(): array {
return [
"Container node with internal action and external children" => [
[
@@ -862,7 +862,7 @@ class secondary_test extends \advanced_testcase {
*
* @return string[]
*/
- public function get_overflow_menu_data_provider(): array {
+ public static function get_overflow_menu_data_provider(): array {
return [
"Active node is the course home node" => [
'/coursehome.php',
@@ -927,7 +927,7 @@ class secondary_test extends \advanced_testcase {
*
* @return array Provider information.
*/
- public function get_overflow_menu_data_course_admin_provider(): array {
+ public static function get_overflow_menu_data_course_admin_provider(): array {
return [
"Backup page returns overflow" => [
'/backup/backup.php',
diff --git a/lib/tests/navigationlib_test.php b/lib/tests/navigationlib_test.php
index e7f63bca581..1b7ec57c344 100644
--- a/lib/tests/navigationlib_test.php
+++ b/lib/tests/navigationlib_test.php
@@ -604,7 +604,7 @@ class navigationlib_test extends \advanced_testcase {
*
* @return array
*/
- public function set_force_into_more_menu_provider(): array {
+ public static function set_force_into_more_menu_provider(): array {
return [
'Navigation node without any children nodes; Force into "more" menu => true.' =>
[
@@ -641,7 +641,7 @@ class navigationlib_test extends \advanced_testcase {
*
* @return array
*/
- public function is_action_link_provider(): array {
+ public static function is_action_link_provider(): array {
return [
'The navigation node has an action link.' =>
[
@@ -694,7 +694,7 @@ class navigationlib_test extends \advanced_testcase {
*
* @return array
*/
- public function action_link_actions_provider(): array {
+ public static function action_link_actions_provider(): array {
return [
'The navigation node has an action link with an action attached.' =>
[
diff --git a/lib/tests/oauth2/discovery/auth_server_config_reader_test.php b/lib/tests/oauth2/discovery/auth_server_config_reader_test.php
index 0fc97a8ef62..20937a3aec3 100644
--- a/lib/tests/oauth2/discovery/auth_server_config_reader_test.php
+++ b/lib/tests/oauth2/discovery/auth_server_config_reader_test.php
@@ -83,7 +83,7 @@ class auth_server_config_reader_test extends \advanced_testcase {
*
* @return array test data.
*/
- public function config_provider(): array {
+ public static function config_provider(): array {
return [
'Valid, good issuer URL, good config' => [
'issuer_url' => 'https://app.example.com',
diff --git a/lib/tests/oauth2_test.php b/lib/tests/oauth2_test.php
index caccb9306d2..e74d6e85651 100644
--- a/lib/tests/oauth2_test.php
+++ b/lib/tests/oauth2_test.php
@@ -119,7 +119,7 @@ class oauth2_test extends \advanced_testcase {
*
* @return array
*/
- public function system_oauth_client_provider() {
+ public static function system_oauth_client_provider(): array {
return [
[
(object) [
@@ -304,7 +304,7 @@ class oauth2_test extends \advanced_testcase {
*
* @return array
*/
- public function create_endpoints_for_standard_issuer_provider(): array {
+ public static function create_endpoints_for_standard_issuer_provider(): array {
return [
'Google' => [
'type' => 'google',
@@ -447,7 +447,7 @@ class oauth2_test extends \advanced_testcase {
*
* @return array
*/
- public function create_custom_profile_fields(): array {
+ public static function create_custom_profile_fields(): array {
return [
'data' =>
[
diff --git a/lib/tests/output/activity_header_test.php b/lib/tests/output/activity_header_test.php
index aa9717c2176..588dca4c2e0 100644
--- a/lib/tests/output/activity_header_test.php
+++ b/lib/tests/output/activity_header_test.php
@@ -60,7 +60,7 @@ class activity_header_test extends \advanced_testcase {
* Provider for the test_set_title unit test.
* @return array
*/
- public function set_title_provider(): array {
+ public static function set_title_provider(): array {
return [
"Set the title with a plain text" => [
"Activity title", "Activity title"
@@ -129,7 +129,7 @@ class activity_header_test extends \advanced_testcase {
*
* @return array[]
*/
- public function get_heading_level_provider(): array {
+ public static function get_heading_level_provider(): array {
return [
'Title not allowed' => [false, '', 2],
'Title allowed, no title' => [true, '', 2],
diff --git a/lib/tests/output/icon_system_test.php b/lib/tests/output/icon_system_test.php
index 6d83c67e725..45056b9ba2d 100644
--- a/lib/tests/output/icon_system_test.php
+++ b/lib/tests/output/icon_system_test.php
@@ -160,7 +160,7 @@ class icon_system_test extends advanced_testcase {
*
* @return array
*/
- public function icon_system_provider(): array {
+ public static function icon_system_provider(): array {
return [
'icon_system => icon_system_standard' => [
icon_system::class,
@@ -211,8 +211,8 @@ class icon_system_test extends advanced_testcase {
*
* @return array
*/
- public function is_valid_subsystem_provider(): array {
- return $this->icon_system_provider();
+ public static function is_valid_subsystem_provider(): array {
+ return self::icon_system_provider();
}
/**
@@ -220,9 +220,9 @@ class icon_system_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_instance_provider(): array {
+ public static function invalid_instance_provider(): array {
return array_filter(
- $this->icon_system_provider(),
+ self::icon_system_provider(),
function($data) {
return !$data[2];
},
@@ -235,9 +235,9 @@ class icon_system_test extends advanced_testcase {
*
* @return array
*/
- public function valid_instance_provider(): array {
+ public static function valid_instance_provider(): array {
return array_filter(
- $this->icon_system_provider(),
+ self::icon_system_provider(),
function($data) {
return $data[2];
},
diff --git a/lib/tests/output/language_menu_test.php b/lib/tests/output/language_menu_test.php
index 64bb0e1f172..16e050593e8 100644
--- a/lib/tests/output/language_menu_test.php
+++ b/lib/tests/output/language_menu_test.php
@@ -101,7 +101,7 @@ class language_menu_test extends \advanced_testcase {
*
* @return array
*/
- public function get_lang_menu_provider(): array {
+ public static function get_lang_menu_provider(): array {
return [
'Lang menu with only the current language' => [
false, 'en', []
diff --git a/lib/tests/output/mustache_helper_collection_test.php b/lib/tests/output/mustache_helper_collection_test.php
index 296bd0185ae..a7b8b814ded 100644
--- a/lib/tests/output/mustache_helper_collection_test.php
+++ b/lib/tests/output/mustache_helper_collection_test.php
@@ -31,7 +31,7 @@ class mustache_helper_collection_test extends \advanced_testcase {
* text by the helper before being passed to other another helper. This prevents
* nested calls to helpers.
*/
- public function get_strip_disallowed_helpers_testcases() {
+ public static function get_strip_disallowed_helpers_testcases(): array {
return [
'no disallowed' => [
'disallowed' => [],
@@ -123,7 +123,7 @@ class mustache_helper_collection_test extends \advanced_testcase {
/**
* Test that the mustache_helper_collection class correctly strips
- * @dataProvider get_strip_disallowed_helpers_testcases()
+ * @dataProvider get_strip_disallowed_helpers_testcases
* @param string[] $disallowed The list of helpers to strip
* @param string $input The input string for the helper
* @param string $expected The expected output of the string after disallowed strip
diff --git a/lib/tests/output/mustache_template_finder_test.php b/lib/tests/output/mustache_template_finder_test.php
index 050ea9e330b..86f0c703af2 100644
--- a/lib/tests/output/mustache_template_finder_test.php
+++ b/lib/tests/output/mustache_template_finder_test.php
@@ -35,7 +35,7 @@ class mustache_template_finder_test extends \advanced_testcase {
*
* @return array
*/
- public function valid_template_directories_provider(): array {
+ public static function valid_template_directories_provider(): array {
return [
'plugin: mod_assign' => [
'component' => 'mod_assign',
@@ -111,7 +111,7 @@ class mustache_template_finder_test extends \advanced_testcase {
*
* @return array
*/
- public function valid_template_filepath_provider(): array {
+ public static function valid_template_filepath_provider(): array {
return [
'Standard core template' => [
'template' => 'core/modal',
diff --git a/lib/tests/output/mustache_template_source_loader_test.php b/lib/tests/output/mustache_template_source_loader_test.php
index 011062dc5cf..33ed5a2f908 100644
--- a/lib/tests/output/mustache_template_source_loader_test.php
+++ b/lib/tests/output/mustache_template_source_loader_test.php
@@ -134,13 +134,13 @@ TBC;
/**
* Data provider for the test_load function.
*/
- public function load_test_cases() {
+ public static function load_test_cases(): array {
$cache = [
'core' => [
'test' => '{{! a comment }}The rest of the template'
]
];
- $loader = $this->build_loader_from_static_cache($cache);
+ $loader = self::build_loader_from_static_cache($cache);
return [
'with comments' => [
@@ -177,7 +177,7 @@ TBC;
/**
* Data provider for the load_with_dependencies function.
*/
- public function load_with_dependencies_test_cases() {
+ public static function load_with_dependencies_test_cases(): array {
// Create a bunch of templates that include one another in various ways. There is
// multiple instances of recursive inclusions to test that the code doensn't get
// stuck in an infinite loop.
@@ -205,7 +205,7 @@ TBC;
'bim' => $bim
]
];
- $loader = $this->build_loader_from_static_cache($cache);
+ $loader = self::build_loader_from_static_cache($cache);
return [
'no template includes w comments' => [
@@ -344,7 +344,7 @@ TBC;
/**
* Data provider for the test_load function.
*/
- public function scan_template_source_for_dependencies_test_cases() {
+ public static function scan_template_source_for_dependencies_test_cases(): array {
$foo = '{{! a comment }}{{> core/bar }}{{< test/bop }}{{/ test/bop}}{{#str}} help, core {{/str}}';
$bar = '{{! a comment }}{{> core/baz }}';
$baz = '{{! a comment }}{{#str}} hide, core {{/str}}';
@@ -388,7 +388,7 @@ TEMPLATE;
'multiline5' => $multiline5,
]
];
- $loader = $this->build_loader_from_static_cache($cache);
+ $loader = self::build_loader_from_static_cache($cache);
return [
'single template include' => [
@@ -488,7 +488,7 @@ TEMPLATE;
/**
* Test the scan_template_source_for_dependencies function.
*
- * @dataProvider scan_template_source_for_dependencies_test_cases()
+ * @dataProvider scan_template_source_for_dependencies_test_cases
* @param mustache_template_source_loader $loader The loader
* @param string $source The template to test
* @param string $expected The expected output
@@ -510,7 +510,7 @@ TEMPLATE;
* @param array $cache A cache of templates
* @return mustache_template_source_loader
*/
- private function build_loader_from_static_cache(array $cache): mustache_template_source_loader {
+ private static function build_loader_from_static_cache(array $cache): mustache_template_source_loader {
return new mustache_template_source_loader(function($component, $name, $themename) use ($cache) {
return $cache[$component][$name];
});
diff --git a/lib/tests/output/participants_action_bar_test.php b/lib/tests/output/participants_action_bar_test.php
index 1dd9707eabd..29a2df4a88e 100644
--- a/lib/tests/output/participants_action_bar_test.php
+++ b/lib/tests/output/participants_action_bar_test.php
@@ -68,7 +68,7 @@ class participants_action_bar_test extends \advanced_testcase {
* Provider for test_get_content_for_select
* @return array[]
*/
- public function get_content_for_select_provider() {
+ public static function get_content_for_select_provider(): array {
return [
'Get dropdown content when in a course context' => [
'course', 3, ['Enrolments', 'Groups', 'Permissions']
diff --git a/lib/tests/outputcomponents_test.php b/lib/tests/outputcomponents_test.php
index 94d40347ae7..bc4b79d58bd 100644
--- a/lib/tests/outputcomponents_test.php
+++ b/lib/tests/outputcomponents_test.php
@@ -781,7 +781,7 @@ EOF;
*
* @return array
*/
- public function block_contents_is_fake_provider() {
+ public static function block_contents_is_fake_provider(): array {
return [
'Null' => [null, false],
'Not set' => [false, false],
diff --git a/lib/tests/outputrequirementslib_test.php b/lib/tests/outputrequirementslib_test.php
index 32535a6a17f..1acd2fe2b6d 100644
--- a/lib/tests/outputrequirementslib_test.php
+++ b/lib/tests/outputrequirementslib_test.php
@@ -163,7 +163,7 @@ final class outputrequirementslib_test extends \advanced_testcase {
* @see \page_requirements_manager::js_fix_url()
* @see \moodle_url
*/
- public function js_fix_url_moodle_url_provider() {
+ public static function js_fix_url_moodle_url_provider(): array {
global $CFG;
$wwwroot = rtrim($CFG->wwwroot, '/');
$libdir = rtrim($CFG->libdir, '/');
@@ -245,7 +245,7 @@ final class outputrequirementslib_test extends \advanced_testcase {
* @return array
* @see \page_requirements_manager::js_fix_url()
*/
- public function js_fix_url_plain_string_provider() {
+ public static function js_fix_url_plain_string_provider(): array {
global $CFG;
$wwwroot = rtrim($CFG->wwwroot, '/');
$admin = "/{$CFG->admin}/"; // Deprecated, just for coverage purposes.
@@ -320,7 +320,7 @@ final class outputrequirementslib_test extends \advanced_testcase {
* @return array
* @see \page_requirements_manager::js_fix_url()
*/
- public function js_fix_url_coding_exception_provider() {
+ public static function js_fix_url_coding_exception_provider(): array {
global $CFG;
$wwwroot = rtrim($CFG->wwwroot, '/');
diff --git a/lib/tests/plugininfo/base_test.php b/lib/tests/plugininfo/base_test.php
index a4c8749d07e..00ea08dfdef 100644
--- a/lib/tests/plugininfo/base_test.php
+++ b/lib/tests/plugininfo/base_test.php
@@ -86,7 +86,7 @@ class base_test extends \advanced_testcase {
*
* @return array
*/
- public function load_disk_version_invalid_supported_version_provider(): array {
+ public static function load_disk_version_invalid_supported_version_provider(): array {
return [
'Invalid supported range.' => [
'supported' => [31, 29],
@@ -152,7 +152,7 @@ class base_test extends \advanced_testcase {
*
* @return array
*/
- public function load_disk_version_invalid_incompatible_version_provider(): array {
+ public static function load_disk_version_invalid_incompatible_version_provider(): array {
return [
[[38]],
[['38']],
@@ -200,7 +200,7 @@ class base_test extends \advanced_testcase {
*
* @return array
*/
- public function load_disk_version_branch_supports_provider(): array {
+ public static function load_disk_version_branch_supports_provider(): array {
return [
'Range, branch in support, lowest' => [
'supported' => [29, 31],
@@ -313,7 +313,7 @@ class base_test extends \advanced_testcase {
*
* @return string[]
*/
- public function plugins_not_supporting_ordering(): array {
+ public static function plugins_not_supporting_ordering(): array {
return [
['mod_assign'],
['block_login'],
diff --git a/lib/tests/plugininfo/block_test.php b/lib/tests/plugininfo/block_test.php
index dd871a46074..f83b12cdd98 100644
--- a/lib/tests/plugininfo/block_test.php
+++ b/lib/tests/plugininfo/block_test.php
@@ -68,7 +68,7 @@ class block_test extends advanced_testcase {
$this->assertEquals($expected, $plugininfo->is_uninstall_allowed());
}
- public function is_uninstall_allowed_provider(): array {
+ public static function is_uninstall_allowed_provider(): array {
$plugins = block::get_enabled_plugins();
return array_map(function ($plugin) {
$expected = true;
diff --git a/lib/tests/plugininfo/editor_test.php b/lib/tests/plugininfo/editor_test.php
index 685d0dea8b2..6b92a20cd3f 100644
--- a/lib/tests/plugininfo/editor_test.php
+++ b/lib/tests/plugininfo/editor_test.php
@@ -101,7 +101,7 @@ class editor_test extends advanced_testcase {
*
* @return array
*/
- public function get_sorted_plugins_provider(): array {
+ public static function get_sorted_plugins_provider(): array {
$pluginmanager = \core_plugin_manager::instance();
$allplugins = array_keys($pluginmanager->get_plugins_of_type('editor'));
@@ -195,7 +195,7 @@ class editor_test extends advanced_testcase {
*
* @return array
*/
- public function change_plugin_order_provider(): array {
+ public static function change_plugin_order_provider(): array {
$pluginmanager = \core_plugin_manager::instance();
$allplugins = array_keys($pluginmanager->get_plugins_of_type('editor'));
diff --git a/lib/tests/plugininfo/media_test.php b/lib/tests/plugininfo/media_test.php
index 14a117cca50..539fd3e9bba 100644
--- a/lib/tests/plugininfo/media_test.php
+++ b/lib/tests/plugininfo/media_test.php
@@ -67,7 +67,7 @@ class media_test extends advanced_testcase {
*
* @return array
*/
- public function is_uninstall_allowed_provider(): array {
+ public static function is_uninstall_allowed_provider(): array {
$plugins = media::get_enabled_plugins();
return array_map(function ($plugin) {
return [
@@ -102,7 +102,7 @@ class media_test extends advanced_testcase {
);
}
- public function change_plugin_order_provider(): array {
+ public static function change_plugin_order_provider(): array {
$pluginmanager = \core_plugin_manager::instance();
$allplugins = $pluginmanager->get_plugins_of_type('media');
\core_collator::asort_objects_by_method($allplugins, 'get_rank', \core_collator::SORT_NUMERIC);
diff --git a/lib/tests/plugininfo/repository_test.php b/lib/tests/plugininfo/repository_test.php
index eb70cc6aa97..fecd9d9c73c 100644
--- a/lib/tests/plugininfo/repository_test.php
+++ b/lib/tests/plugininfo/repository_test.php
@@ -56,7 +56,7 @@ class repository_test extends \advanced_testcase {
*
* @return array
*/
- public function enable_plugin_provider(): array {
+ public static function enable_plugin_provider(): array {
return [
'Disable an enable and visible repository' => [
'pluginname' => 'contentbank',
diff --git a/lib/tests/questionlib_test.php b/lib/tests/questionlib_test.php
index 3102f5c149e..de6464cc6e7 100644
--- a/lib/tests/questionlib_test.php
+++ b/lib/tests/questionlib_test.php
@@ -1541,7 +1541,7 @@ class questionlib_test extends \advanced_testcase {
*
* @return array
*/
- public function question_capability_on_question_provider() {
+ public static function question_capability_on_question_provider(): array {
return [
'Unrelated capability which is present' => [
'capabilities' => [
@@ -2171,7 +2171,7 @@ class questionlib_test extends \advanced_testcase {
*
* @return array test cases.
*/
- public function find_next_unused_idnumber_cases(): array {
+ public static function find_next_unused_idnumber_cases(): array {
return [
[null, null],
['id', null],
diff --git a/lib/tests/rtlcss_test.php b/lib/tests/rtlcss_test.php
index 55c7ecb2975..90ff4bb00ca 100644
--- a/lib/tests/rtlcss_test.php
+++ b/lib/tests/rtlcss_test.php
@@ -38,7 +38,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function background_image_provider() {
+ public static function background_image_provider(): array {
return [
/* Not supported by MoodleHQ/RTLCSS yet.
[[
@@ -78,7 +78,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function background_position_provider() {
+ public static function background_position_provider(): array {
return [
[[
'should' => 'Should complement percentage horizontal position ',
@@ -182,7 +182,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function background_provider() {
+ public static function background_provider(): array {
return [
[[
'should' => 'Should treat 0 as 0%',
@@ -271,7 +271,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function directives_provider() {
+ public static function directives_provider(): array {
return [
[[
'should' => 'Should ignore flipping - rule level (default)',
@@ -356,7 +356,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function properties_provider() {
+ public static function properties_provider(): array {
return [
[[
'should' => 'Should mirror property name: border-top-right-radius',
@@ -419,7 +419,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function special_provider() {
+ public static function special_provider(): array {
return [
/* Not supported by MoodleHQ/RTLCSS yet.
[[
@@ -437,7 +437,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function transform_origin_provider() {
+ public static function transform_origin_provider(): array {
return [
[[
'should' => 'Should mirror (x-offset: 0 means 0%)',
@@ -612,7 +612,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function transforms_provider() {
+ public static function transforms_provider(): array {
return [
/* Not supported by MoodleHQ/RTLCSS yet.
[[
@@ -896,7 +896,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function values_nsyntax_provider() {
+ public static function values_nsyntax_provider(): array {
return [
[[
'should' => 'Should mirror property value: border-radius (4 values)',
@@ -1017,7 +1017,7 @@ class rtlcss_test extends basic_testcase {
* Data provider.
* @return array
*/
- public function values_provider() {
+ public static function values_provider(): array {
return [
[[
'should' => 'Should mirror property value: clear',
diff --git a/lib/tests/scss_test.php b/lib/tests/scss_test.php
index 06eb1db0e42..b2e23981665 100644
--- a/lib/tests/scss_test.php
+++ b/lib/tests/scss_test.php
@@ -32,7 +32,7 @@ class scss_test extends \advanced_testcase {
* Data provider for is_valid_file
* @return array
*/
- public function is_valid_file_provider() {
+ public static function is_valid_file_provider(): array {
$themedirectory = \core_component::get_component_directory('theme_boost');
$realroot = realpath($themedirectory);
return [
@@ -66,7 +66,7 @@ class scss_test extends \advanced_testcase {
/**
* Test cases for SassC compilation.
*/
- public function scss_compilation_provider() {
+ public static function scss_compilation_provider(): array {
return [
'simple' => [
'scss' => '$font-stack: Helvetica, sans-serif;
diff --git a/lib/tests/session/manager_test.php b/lib/tests/session/manager_test.php
index 0c685c59863..4d7399d3e80 100644
--- a/lib/tests/session/manager_test.php
+++ b/lib/tests/session/manager_test.php
@@ -861,7 +861,7 @@ final class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function sessionlocks_info_provider(): array {
+ public static function sessionlocks_info_provider(): array {
return [
[
'url' => null,
diff --git a/lib/tests/sessionlib_test.php b/lib/tests/sessionlib_test.php
index c470eeefc21..0ddee1c6c46 100644
--- a/lib/tests/sessionlib_test.php
+++ b/lib/tests/sessionlib_test.php
@@ -169,7 +169,7 @@ class sessionlib_test extends \advanced_testcase {
*
* @return array of config and secure result
*/
- public function moodle_cookie_secure_provider() {
+ public static function moodle_cookie_secure_provider(): array {
return array(
array(
// Non ssl, not set.
diff --git a/lib/tests/setuplib_test.php b/lib/tests/setuplib_test.php
index 616b3441b01..4b98d6bd05e 100644
--- a/lib/tests/setuplib_test.php
+++ b/lib/tests/setuplib_test.php
@@ -426,7 +426,7 @@ class setuplib_test extends \advanced_testcase {
*
* @return array An array of arrays contain test data
*/
- public function data_for_test_get_real_size() {
+ public static function data_for_test_get_real_size(): array {
return array(
array('8KB', 8192),
array('8Kb', 8192),
diff --git a/lib/tests/statslib_test.php b/lib/tests/statslib_test.php
index 70e8950285b..7cb1e639e83 100644
--- a/lib/tests/statslib_test.php
+++ b/lib/tests/statslib_test.php
@@ -186,7 +186,7 @@ class statslib_test extends \advanced_testcase {
*
* @return array of fixture XML log file names.
*/
- public function daily_log_provider() {
+ public static function daily_log_provider(): array {
$logfiles = array();
$fileno = array('00', '01', '02', '03', '04', '05', '06', '07', '08');
@@ -202,7 +202,7 @@ class statslib_test extends \advanced_testcase {
*
* @return array Dates and timezones for which the first day of the week will be calculated
*/
- public function get_base_weekly_provider() {
+ public static function get_base_weekly_provider(): array {
return [
[
"startwday" => 0,
diff --git a/lib/tests/string_manager_standard_test.php b/lib/tests/string_manager_standard_test.php
index 81cc3b4b8f7..949a3c6737b 100644
--- a/lib/tests/string_manager_standard_test.php
+++ b/lib/tests/string_manager_standard_test.php
@@ -97,14 +97,12 @@ class string_manager_standard_test extends \advanced_testcase {
*
* @return array
*/
- public function get_deprecated_strings_provider() {
+ public static function get_deprecated_strings_provider(): array {
global $CFG;
- $teststringman = testable_core_string_manager::instance($CFG->langotherroot, $CFG->langlocalroot, array());
+ $teststringman = testable_core_string_manager::instance($CFG->langotherroot, $CFG->langlocalroot, []);
$allstrings = $teststringman->get_all_deprecated_strings();
- return array_map(function($string) {
- return [$string];
- }, $allstrings);
+ return array_map(fn ($string): array => [$string], $allstrings);
}
/**
diff --git a/lib/tests/task/database_logger_test.php b/lib/tests/task/database_logger_test.php
index f71e27ea3f2..f1702af9aa0 100644
--- a/lib/tests/task/database_logger_test.php
+++ b/lib/tests/task/database_logger_test.php
@@ -238,7 +238,7 @@ class database_logger_test extends \advanced_testcase {
*
* @return array
*/
- public function delete_task_logs_provider(): array {
+ public static function delete_task_logs_provider(): array {
return [
[
[0],
diff --git a/lib/tests/task/file_temp_cleanup_task_test.php b/lib/tests/task/file_temp_cleanup_task_test.php
index e289a900b26..642c062cbbc 100644
--- a/lib/tests/task/file_temp_cleanup_task_test.php
+++ b/lib/tests/task/file_temp_cleanup_task_test.php
@@ -16,6 +16,8 @@
namespace core\task;
+use stdClass;
+
/**
* Unit tests for the file_temp_cleanup task.
*
@@ -25,14 +27,13 @@ namespace core\task;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \core\task\file_temp_cleanup_task
*/
-class file_temp_cleanup_task_test extends \basic_testcase {
-
+final class file_temp_cleanup_task_test extends \basic_testcase {
/**
* Data provider for cron_delete_from_temp.
*
* @return array Provider data
*/
- public function cron_delete_from_temp_provider() {
+ public static function cron_delete_from_temp_provider(): array {
global $CFG;
$tmpdir = realpath($CFG->tempdir);
@@ -46,45 +47,45 @@ class file_temp_cleanup_task_test extends \basic_testcase {
$nodes = array();
// Really old directory to remove.
- $nodes[] = $this->generate_test_path('/dir1/dir1_1/dir1_1_1/dir1_1_1_1/', true, $lastweekstime * 52, false);
+ $nodes[] = self::generate_test_path('/dir1/dir1_1/dir1_1_1/dir1_1_1_1/', true, $lastweekstime * 52, false);
// New Directory to keep.
- $nodes[] = $this->generate_test_path('/dir1/dir1_2/', true, $time, true);
+ $nodes[] = self::generate_test_path('/dir1/dir1_2/', true, $time, true);
// Directory a little less than 1 week old, keep.
- $nodes[] = $this->generate_test_path('/dir2/', true, $afterlastweekstime, true);
+ $nodes[] = self::generate_test_path('/dir2/', true, $afterlastweekstime, true);
// Directory older than 1 week old, remove.
- $nodes[] = $this->generate_test_path('/dir3/', true, $beforelastweekstime, false);
+ $nodes[] = self::generate_test_path('/dir3/', true, $beforelastweekstime, false);
// File older than 1 week old, remove.
- $nodes[] = $this->generate_test_path('/dir1/dir1_1/dir1_1_1/file1_1_1_1', false, $beforelastweekstime, false);
+ $nodes[] = self::generate_test_path('/dir1/dir1_1/dir1_1_1/file1_1_1_1', false, $beforelastweekstime, false);
// New File to keep.
- $nodes[] = $this->generate_test_path('/dir1/dir1_1/dir1_1_1/file1_1_1_2', false, $time, true);
+ $nodes[] = self::generate_test_path('/dir1/dir1_1/dir1_1_1/file1_1_1_2', false, $time, true);
// File older than 1 week old, remove.
- $nodes[] = $this->generate_test_path('/dir1/dir1_2/file1_1_2_1', false, $beforelastweekstime, false);
+ $nodes[] = self::generate_test_path('/dir1/dir1_2/file1_1_2_1', false, $beforelastweekstime, false);
// New file to keep.
- $nodes[] = $this->generate_test_path('/dir1/dir1_2/file1_1_2_2', false, $time, true);
+ $nodes[] = self::generate_test_path('/dir1/dir1_2/file1_1_2_2', false, $time, true);
// New file to keep.
- $nodes[] = $this->generate_test_path('/file1', false, $time, true);
+ $nodes[] = self::generate_test_path('/file1', false, $time, true);
// File older than 1 week, keep.
- $nodes[] = $this->generate_test_path('/file2', false, $beforelastweekstime, false);
+ $nodes[] = self::generate_test_path('/file2', false, $beforelastweekstime, false);
// Directory older than 1 week to keep.
// Note: Since this directory contains a directory that contains a file that is also older than a week
// the directory won't be deleted since it's mtime will be updated when the file is deleted.
- $nodes[] = $this->generate_test_path('/dir4/dir4_1', true, $beforelastweekstime, true);
+ $nodes[] = self::generate_test_path('/dir4/dir4_1', true, $beforelastweekstime, true);
- $nodes[] = $this->generate_test_path('/dir4/dir4_1/dir4_1_1/', true, $beforelastweekstime, true);
+ $nodes[] = self::generate_test_path('/dir4/dir4_1/dir4_1_1/', true, $beforelastweekstime, true);
// File older than 1 week to remove.
- $nodes[] = $this->generate_test_path('/dir4/dir4_1/dir4_1_1/file4_1_1_1', false, $beforelastweekstime, false);
+ $nodes[] = self::generate_test_path('/dir4/dir4_1/dir4_1_1/file4_1_1_1', false, $beforelastweekstime, false);
$expectednodes = array();
foreach ($nodes as $node) {
@@ -104,16 +105,10 @@ class file_temp_cleanup_task_test extends \basic_testcase {
}
sort($expectednodes);
- $data = array(
- array(
- $nodes,
- $expectednodes
- ),
- array(
- array(),
- array()
- )
- );
+ $data = [
+ [$nodes, $expectednodes],
+ [[], []],
+ ];
return $data;
}
@@ -126,13 +121,13 @@ class file_temp_cleanup_task_test extends \basic_testcase {
* @param int $time modified time of the node in epoch
* @param bool $keep Should the node exist after the delete function has run
*/
- private function generate_test_path($path, $isdir = false, $time = 0, $keep = false) {
- $node = new \stdClass();
- $node->path = $path;
- $node->isdir = $isdir;
- $node->time = $time;
- $node->keep = $keep;
- return $node;
+ private static function generate_test_path($path, $isdir = false, $time = 0, $keep = false): stdClass {
+ return (object) [
+ 'path' => $path,
+ 'isdir' => $isdir,
+ 'time' => $time,
+ 'keep' => $keep,
+ ];
}
/**
* Test removing files and directories from tempdir.
diff --git a/lib/tests/task/hide_ended_courses_task_test.php b/lib/tests/task/hide_ended_courses_task_test.php
index eca5d2caa34..fb98677a792 100644
--- a/lib/tests/task/hide_ended_courses_task_test.php
+++ b/lib/tests/task/hide_ended_courses_task_test.php
@@ -31,7 +31,6 @@ require_once(__DIR__ . '/show_started_courses_task_test.php');
* @coversDefaultClass \core\task\hide_ended_courses_task
*/
class hide_ended_courses_task_test extends \core\task\show_started_courses_task_test {
-
/**
* Test hide_ended_courses cron task.
*
diff --git a/lib/tests/task/scheduled_task_test.php b/lib/tests/task/scheduled_task_test.php
index 11a1fed5979..04de8d1c1ce 100644
--- a/lib/tests/task/scheduled_task_test.php
+++ b/lib/tests/task/scheduled_task_test.php
@@ -944,7 +944,7 @@ class scheduled_task_test extends \advanced_testcase {
*
* @return array[]
*/
- public function is_component_enabled_provider(): array {
+ public static function is_component_enabled_provider(): array {
return [
'Enabled component' => ['auth_cas', true],
'Disabled component' => ['auth_ldap', false],
diff --git a/lib/tests/task/show_started_courses_task_test.php b/lib/tests/task/show_started_courses_task_test.php
index 2bc19853fac..d5ab8654f12 100644
--- a/lib/tests/task/show_started_courses_task_test.php
+++ b/lib/tests/task/show_started_courses_task_test.php
@@ -116,7 +116,7 @@ class show_started_courses_task_test extends advanced_testcase {
*
* @return array
*/
- public function get_courses_provider(): array {
+ public static function get_courses_provider(): array {
return [
'No hidden courses' => [
'lastweek' => 0,
diff --git a/lib/tests/text_test.php b/lib/tests/text_test.php
index 94f5c113278..e632d11f0e0 100644
--- a/lib/tests/text_test.php
+++ b/lib/tests/text_test.php
@@ -607,7 +607,7 @@ class text_test extends advanced_testcase {
/**
* Tests the static checker is_charset_supported
*
- * @dataProvider is_charset_supported_provider()
+ * @dataProvider is_charset_supported_provider
* @param string $charset
* @param bool $expected
* @covers ::is_charset_supported()
@@ -621,7 +621,7 @@ class text_test extends advanced_testcase {
* Provider for the test_is_charset_supported()
* @return array[]
*/
- public function is_charset_supported_provider() {
+ public static function is_charset_supported_provider(): array {
return [
"Check unsupported windows charset" => [
"cp1250", false
diff --git a/lib/tests/upgrade_util_test.php b/lib/tests/upgrade_util_test.php
index 22947cb4a73..8a6209d85cd 100644
--- a/lib/tests/upgrade_util_test.php
+++ b/lib/tests/upgrade_util_test.php
@@ -38,7 +38,7 @@ class upgrade_util_test extends \advanced_testcase {
/**
* Test PHP/cURL validation.
*
- * @dataProvider validate_php_curl_tls_testcases()
+ * @dataProvider validate_php_curl_tls_testcases
* @param array $curlinfo server curl_version array
* @param int $zts 0 or 1 as defined by PHP_ZTS
* @param bool $expected expected result
@@ -50,7 +50,7 @@ class upgrade_util_test extends \advanced_testcase {
/**
* Test cases for validate_php_curl_tls test.
*/
- public function validate_php_curl_tls_testcases() {
+ public static function validate_php_curl_tls_testcases(): array {
$base = curl_version();
return [
@@ -125,7 +125,7 @@ class upgrade_util_test extends \advanced_testcase {
*
* @return array of testcases
*/
- public function can_use_tls12_testcases() {
+ public static function can_use_tls12_testcases(): array {
return [
// Bad versions.
['OpenSSL/0.9.8o', null, false],
diff --git a/lib/tests/upgradelib_test.php b/lib/tests/upgradelib_test.php
index a16b9ba06d3..f0d1942d9fc 100644
--- a/lib/tests/upgradelib_test.php
+++ b/lib/tests/upgradelib_test.php
@@ -744,7 +744,7 @@ class upgradelib_test extends advanced_testcase {
*
* @return array
*/
- public function serialized_strings_dataprovider() {
+ public static function serialized_strings_dataprovider(): array {
return [
'A configuration that uses the old object' => [
'O:6:"object":3:{s:4:"text";s:32:"Nothing that anyone cares about.";s:5:"title";s:16:"Really old block";s:6:"format";s:1:"1";}',
@@ -1427,7 +1427,7 @@ class upgradelib_test extends advanced_testcase {
*
* @return array
*/
- public function usermenu_items_dataprovider(): array {
+ public static function usermenu_items_dataprovider(): array {
return [
'Add new item to empty usermenu' => [
'',
diff --git a/lib/tests/user_menu_test.php b/lib/tests/user_menu_test.php
index ec869c858f2..9225a5312be 100644
--- a/lib/tests/user_menu_test.php
+++ b/lib/tests/user_menu_test.php
@@ -30,7 +30,7 @@ class user_menu_test extends \advanced_testcase {
*
* @return array containing testing data
*/
- public function custom_user_menu_data() {
+ public static function custom_user_menu_data(): array {
return array(
// These are fillers only.
array('###', 0, 1),
diff --git a/lib/tests/useragent_test.php b/lib/tests/useragent_test.php
index 2aed0021115..9b961e94675 100644
--- a/lib/tests/useragent_test.php
+++ b/lib/tests/useragent_test.php
@@ -37,7 +37,7 @@ class useragent_test extends advanced_testcase {
*
* @return array
*/
- public function user_agents_providers() {
+ public static function user_agents_providers(): array {
// Note: When adding new entries to this list, please ensure that any new browser versions are added to the corresponding list.
// This ensures that regression tests are applied to all known user agents.
return array(
diff --git a/lib/tests/weblib_format_text_test.php b/lib/tests/weblib_format_text_test.php
index 21ebe1ceef1..7df0a021054 100644
--- a/lib/tests/weblib_format_text_test.php
+++ b/lib/tests/weblib_format_text_test.php
@@ -149,7 +149,7 @@ class weblib_format_text_test extends \advanced_testcase {
*
* @return array of testcases
*/
- public function format_text_blanktarget_testcases() {
+ public static function format_text_blanktarget_testcases(): array {
return [
'Simple link' => [
'Hey, that\'s pretty good!',
@@ -230,7 +230,7 @@ class weblib_format_text_test extends \advanced_testcase {
*
* @return array of testcases (string)testcasename => [(string)input, (string)nocleaned, (string)cleaned]
*/
- public function format_text_cleaning_testcases() {
+ public static function format_text_cleaning_testcases(): array {
return [
'JavaScript' => [
'Hello world',
diff --git a/lib/tests/weblib_test.php b/lib/tests/weblib_test.php
index 1a5d4f84553..6c730c5bc96 100644
--- a/lib/tests/weblib_test.php
+++ b/lib/tests/weblib_test.php
@@ -360,7 +360,7 @@ class weblib_test extends advanced_testcase {
/**
* Data provider for trusttext_pre_edit() tests.
*/
- public function trusttext_pre_edit_provider(): array {
+ public static function trusttext_pre_edit_provider(): array {
return [
[true, 0, 'editingteacher', FORMAT_HTML, 1],
[true, 0, 'editingteacher', FORMAT_MOODLE, 1],
@@ -629,7 +629,7 @@ EXPECTED;
/**
* Data provider for test_content_to_text.
*/
- public static function provider_content_to_text() {
+ public static function provider_content_to_text(): array {
return array(
array('asd', false, 'asd'),
// Trim '\r\n '.
@@ -655,7 +655,7 @@ EXPECTED;
*
* @return array Returns aray of test data for the test_validate_email function
*/
- public function data_validate_email() {
+ public static function data_validate_email(): array {
return [
// Test addresses that should pass.
[
@@ -823,7 +823,7 @@ EXPECTED;
/**
* Data provider for test_get_file_argument.
*/
- public static function provider_get_file_argument() {
+ public static function provider_get_file_argument(): array {
return array(
// Serving SCORM content w/o HTTP GET params.
array(array(
@@ -1071,7 +1071,7 @@ EXPECTED;
*
* @return string[][]
*/
- public function get_html_lang_attribute_value_provider() {
+ public static function get_html_lang_attribute_value_provider(): array {
return [
'Empty lang code' => [' ', 'en'],
'English' => ['en', 'en'],
@@ -1098,7 +1098,7 @@ EXPECTED;
*
* @return array
*/
- public function strip_querystring_provider(): array {
+ public static function strip_querystring_provider(): array {
return [
'Null' => [null, ''],
'Empty string' => ['', ''],
diff --git a/lib/xapi/tests/external/delete_state_test.php b/lib/xapi/tests/external/delete_state_test.php
index 9d5c97d0a55..de72aca5bcd 100644
--- a/lib/xapi/tests/external/delete_state_test.php
+++ b/lib/xapi/tests/external/delete_state_test.php
@@ -74,7 +74,7 @@ class delete_state_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function components_provider(): array {
+ public static function components_provider(): array {
return [
'Inexistent component' => [
'component' => 'inexistent_component',
@@ -151,7 +151,7 @@ class delete_state_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function states_provider(): array {
+ public static function states_provider(): array {
return [
'Existing and valid state' => [
'info' => [],
diff --git a/lib/xapi/tests/external/delete_states_test.php b/lib/xapi/tests/external/delete_states_test.php
index 95e5c890a16..0b262072477 100644
--- a/lib/xapi/tests/external/delete_states_test.php
+++ b/lib/xapi/tests/external/delete_states_test.php
@@ -136,7 +136,7 @@ class delete_states_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function components_provider(): array {
+ public static function components_provider(): array {
return [
'Inexistent component' => [
'component' => 'inexistent_component',
@@ -264,7 +264,7 @@ class delete_states_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function states_provider(): array {
+ public static function states_provider(): array {
return [
'Activities with different users and components' => [
'username' => 'user1',
diff --git a/lib/xapi/tests/external/get_state_test.php b/lib/xapi/tests/external/get_state_test.php
index 40677b52208..34238ab0c19 100644
--- a/lib/xapi/tests/external/get_state_test.php
+++ b/lib/xapi/tests/external/get_state_test.php
@@ -75,7 +75,7 @@ class get_state_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function components_provider(): array {
+ public static function components_provider(): array {
return [
'Inexistent component' => [
'component' => 'inexistent_component',
@@ -151,7 +151,7 @@ class get_state_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function states_provider(): array {
+ public static function states_provider(): array {
return [
'Existing and valid state' => [
'info' => [],
diff --git a/lib/xapi/tests/external/get_states_test.php b/lib/xapi/tests/external/get_states_test.php
index f7a38316e85..2977167dab6 100644
--- a/lib/xapi/tests/external/get_states_test.php
+++ b/lib/xapi/tests/external/get_states_test.php
@@ -146,7 +146,7 @@ class get_states_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function components_provider(): array {
+ public static function components_provider(): array {
return [
'Inexistent component' => [
'component' => 'inexistent_component',
@@ -190,7 +190,7 @@ class get_states_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function since_formats_provider(): array {
+ public static function since_formats_provider(): array {
return [
'Null date' => [
'since' => null,
@@ -243,7 +243,7 @@ class get_states_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function activity_iri_provider(): array {
+ public static function activity_iri_provider(): array {
return [
'Activity with several states' => [
'activityiri' => iri::generate('1', 'activity'),
@@ -295,7 +295,7 @@ class get_states_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function agent_values_provider(): array {
+ public static function agent_values_provider(): array {
return [
'Current user' => [
'agentreference' => 'current',
@@ -333,7 +333,7 @@ class get_states_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function registration_values_provider(): array {
+ public static function registration_values_provider(): array {
return [
'Null registration' => [
'registration' => null,
diff --git a/lib/xapi/tests/external/post_state_test.php b/lib/xapi/tests/external/post_state_test.php
index 72ad9345893..8c99942fa59 100644
--- a/lib/xapi/tests/external/post_state_test.php
+++ b/lib/xapi/tests/external/post_state_test.php
@@ -73,7 +73,7 @@ class post_state_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function components_provider(): array {
+ public static function components_provider(): array {
return [
'Inexistent component' => [
'component' => 'inexistent_component',
@@ -136,7 +136,7 @@ class post_state_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function states_provider(): array {
+ public static function states_provider(): array {
return [
'Empty stateid' => [
'stateid' => '',
diff --git a/lib/xapi/tests/external/post_statement_test.php b/lib/xapi/tests/external/post_statement_test.php
index f1fca734181..4647bab0e72 100644
--- a/lib/xapi/tests/external/post_statement_test.php
+++ b/lib/xapi/tests/external/post_statement_test.php
@@ -188,7 +188,7 @@ class post_statement_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function components_provider(): array {
+ public static function components_provider(): array {
return [
'Inexistent component' => [
'inexistent_component', []
@@ -234,7 +234,7 @@ class post_statement_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function invalid_json_provider(): array {
+ public static function invalid_json_provider(): array {
return [
'Wrong json' => [
'This is not { a json object /'
@@ -377,7 +377,7 @@ class post_statement_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function statement_provider(): array {
+ public static function statement_provider(): array {
return [
// Single statement with group statements enabled.
'Single, Valid actor, valid verb' => [
@@ -450,7 +450,7 @@ class post_statement_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function group_statement_provider(): array {
+ public static function group_statement_provider(): array {
return [
// Single statement with group statements enabled.
'Group statement + group statement without group support' => [
diff --git a/lib/xapi/tests/iri_test.php b/lib/xapi/tests/iri_test.php
index c274e3aa6ed..98933b70152 100644
--- a/lib/xapi/tests/iri_test.php
+++ b/lib/xapi/tests/iri_test.php
@@ -76,7 +76,7 @@ class iri_test extends advanced_testcase {
*
* @return array
*/
- public function iri_samples_provider(): array {
+ public static function iri_samples_provider(): array {
global $CFG;
return [
@@ -120,7 +120,7 @@ class iri_test extends advanced_testcase {
*
* @return array
*/
- public function iri_check_provider(): array {
+ public static function iri_check_provider(): array {
return [
'Real IRI http' => [
'http://adlnet.gov/expapi/activities/example',
diff --git a/lib/xapi/tests/local/statement/item_activity_test.php b/lib/xapi/tests/local/statement/item_activity_test.php
index 6b05c63b0a2..60a8a815cc3 100644
--- a/lib/xapi/tests/local/statement/item_activity_test.php
+++ b/lib/xapi/tests/local/statement/item_activity_test.php
@@ -113,7 +113,7 @@ class item_activity_test extends advanced_testcase {
*
* @return array
*/
- public function create_from_id_provider(): array {
+ public static function create_from_id_provider(): array {
return [
'Fake IRI with no definition' => [
'paella', false,
@@ -155,7 +155,7 @@ class item_activity_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_data_provider(): array {
+ public static function invalid_data_provider(): array {
return [
'Invalid Avtivity objectType' => [
'Invalid Type!', iri::generate('paella', 'activity'),
diff --git a/lib/xapi/tests/local/statement/item_agent_test.php b/lib/xapi/tests/local/statement/item_agent_test.php
index b5e8a6e65c9..7e17eeeab4e 100644
--- a/lib/xapi/tests/local/statement/item_agent_test.php
+++ b/lib/xapi/tests/local/statement/item_agent_test.php
@@ -143,7 +143,7 @@ class item_agent_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_data_provider(): array {
+ public static function invalid_data_provider(): array {
return [
'Wrong objecttype' => [
'Invalid', true, true
@@ -203,7 +203,7 @@ class item_agent_test extends advanced_testcase {
*
* @return array
*/
- public function unspupported_create_provider(): array {
+ public static function unspupported_create_provider(): array {
return [
'Both mbox and account' => [
true, true, false, false
diff --git a/lib/xapi/tests/local/statement/item_attachment_test.php b/lib/xapi/tests/local/statement/item_attachment_test.php
index 37cd56c1271..97dd7b15591 100644
--- a/lib/xapi/tests/local/statement/item_attachment_test.php
+++ b/lib/xapi/tests/local/statement/item_attachment_test.php
@@ -94,7 +94,7 @@ class item_attachment_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_values_data(): array {
+ public static function invalid_values_data(): array {
return [
'No usageType attachment' => [
'usageType', null
diff --git a/lib/xapi/tests/local/statement/item_definition_test.php b/lib/xapi/tests/local/statement/item_definition_test.php
index 65185bc243f..cbc2a52b9b2 100644
--- a/lib/xapi/tests/local/statement/item_definition_test.php
+++ b/lib/xapi/tests/local/statement/item_definition_test.php
@@ -72,7 +72,7 @@ class item_definition_test extends advanced_testcase {
*
* @return array
*/
- public function creation_provider(): array {
+ public static function creation_provider(): array {
return [
'No interactionType' => [''],
'Choice' => ['choice'],
diff --git a/lib/xapi/tests/local/statement/item_group_test.php b/lib/xapi/tests/local/statement/item_group_test.php
index ec9920905a2..b7bef6d34a5 100644
--- a/lib/xapi/tests/local/statement/item_group_test.php
+++ b/lib/xapi/tests/local/statement/item_group_test.php
@@ -143,7 +143,7 @@ class item_group_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_data_provider(): array {
+ public static function invalid_data_provider(): array {
return [
'Wrong objecttype' => [
'Invalid', true, true
diff --git a/lib/xapi/tests/local/statement/item_object_test.php b/lib/xapi/tests/local/statement/item_object_test.php
index 4abd2bf68fb..a9de796cfe2 100644
--- a/lib/xapi/tests/local/statement/item_object_test.php
+++ b/lib/xapi/tests/local/statement/item_object_test.php
@@ -117,7 +117,7 @@ class item_object_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_data_provider(): array {
+ public static function invalid_data_provider(): array {
return [
'Empty or null id' => [
'',
diff --git a/lib/xapi/tests/local/statement/item_result_test.php b/lib/xapi/tests/local/statement/item_result_test.php
index 49d29545ddd..7bd95615027 100644
--- a/lib/xapi/tests/local/statement/item_result_test.php
+++ b/lib/xapi/tests/local/statement/item_result_test.php
@@ -98,7 +98,7 @@ class item_result_test extends advanced_testcase {
*
* @return array
*/
- public function duration_values_data(): array {
+ public static function duration_values_data(): array {
return [
'No duration' => [
null, null, false
diff --git a/lib/xapi/tests/local/statement/item_verb_test.php b/lib/xapi/tests/local/statement/item_verb_test.php
index c57e30678e4..07892e95edb 100644
--- a/lib/xapi/tests/local/statement/item_verb_test.php
+++ b/lib/xapi/tests/local/statement/item_verb_test.php
@@ -75,7 +75,7 @@ class item_verb_test extends advanced_testcase {
*
* @return array
*/
- public function create_from_id_provider(): array {
+ public static function create_from_id_provider(): array {
return [
'Fake IRI' => [
'cook',
@@ -105,7 +105,7 @@ class item_verb_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_data_provider(): array {
+ public static function invalid_data_provider(): array {
return [
'Empty or null id' => [
'',
diff --git a/lib/xapi/tests/local/statement_test.php b/lib/xapi/tests/local/statement_test.php
index e5c1ccff51c..fd47fbc9b23 100644
--- a/lib/xapi/tests/local/statement_test.php
+++ b/lib/xapi/tests/local/statement_test.php
@@ -184,7 +184,7 @@ class statement_test extends advanced_testcase {
*
* @return array
*/
- public function create_provider(): array {
+ public static function create_provider(): array {
return [
'Agent statement with no extras' => [
true, [], []
@@ -413,7 +413,7 @@ class statement_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_gets_provider(): array {
+ public static function invalid_gets_provider(): array {
return [
'Method get_user on empty statement' => ['get_user', true],
'Method get_all_users on empty statement' => ['get_all_users', true],
@@ -532,7 +532,7 @@ class statement_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_data_provider(): array {
+ public static function invalid_data_provider(): array {
return [
'No actor, no verb, no object' => [false, false, false],
'No actor, verb, no object' => [false, true, false],
diff --git a/lib/xapi/tests/state_store_test.php b/lib/xapi/tests/state_store_test.php
index eddaa3918fa..f666d106c51 100644
--- a/lib/xapi/tests/state_store_test.php
+++ b/lib/xapi/tests/state_store_test.php
@@ -114,7 +114,7 @@ class state_store_test extends advanced_testcase {
*
* @return array
*/
- public function states_provider(): array {
+ public static function states_provider(): array {
return [
'Existing and valid state' => [
'info' => [],
@@ -194,7 +194,7 @@ class state_store_test extends advanced_testcase {
*
* @return array
*/
- public function put_states_provider(): array {
+ public static function put_states_provider(): array {
return [
'Update existing state' => [
'info' => [],
@@ -335,7 +335,7 @@ class state_store_test extends advanced_testcase {
*
* @return array
*/
- public function reset_wipe_states_provider(): array {
+ public static function reset_wipe_states_provider(): array {
return [
'With fake_component' => [
'info' => [],
@@ -502,7 +502,7 @@ class state_store_test extends advanced_testcase {
*
* @return array
*/
- public function get_state_ids_provider(): array {
+ public static function get_state_ids_provider(): array {
return [
'empty_component' => [
'component' => 'empty_component',
@@ -584,7 +584,7 @@ class state_store_test extends advanced_testcase {
*
* @return array
*/
- public function invalid_activityid_format_provider(): array {
+ public static function invalid_activityid_format_provider(): array {
return [
'delete' => [
'operation' => 'delete',
diff --git a/login/tests/login_lib_test.php b/login/tests/login_lib_test.php
index 2cab15a4174..30659890985 100644
--- a/login/tests/login_lib_test.php
+++ b/login/tests/login_lib_test.php
@@ -233,7 +233,7 @@ class login_lib_test extends \advanced_testcase {
/**
* Data provider for \core_login_lib_testcase::test_core_login_validate_forgot_password_data().
*/
- public function forgot_password_data_provider() {
+ public static function forgot_password_data_provider(): array {
return [
'Both username and password supplied' => [
[
diff --git a/media/player/videojs/tests/player_test.php b/media/player/videojs/tests/player_test.php
index 71aff5bc4e1..14cdc735e69 100644
--- a/media/player/videojs/tests/player_test.php
+++ b/media/player/videojs/tests/player_test.php
@@ -289,7 +289,7 @@ class player_test extends \advanced_testcase {
*
* @return array
*/
- public function youtube_start_time_provider(): array {
+ public static function youtube_start_time_provider(): array {
return [
['https://www.youtube.com/watch?v=JNJMF1l3udM&t=1h11s', 3611],
['https://www.youtube.com/watch?v=dv2f_xfmbD8&index=4&list=PLxcO_MFWQBDcyn9xpbmx601YSDlDcTcr0&t=1m5s', 65],
diff --git a/message/tests/externallib_test.php b/message/tests/externallib_test.php
index 832b849140a..5f6bff81279 100644
--- a/message/tests/externallib_test.php
+++ b/message/tests/externallib_test.php
@@ -5139,7 +5139,7 @@ class externallib_test extends externallib_advanced_testcase {
/**
* Data provider for test_get_conversation_counts().
*/
- public function get_conversation_counts_test_cases() {
+ public static function get_conversation_counts_test_cases(): array {
$typeindividual = \core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL;
$typegroup = \core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP;
$typeself = \core_message\api::MESSAGE_CONVERSATION_TYPE_SELF;
@@ -5502,7 +5502,7 @@ class externallib_test extends externallib_advanced_testcase {
/**
* Test the get_conversation_counts() function.
*
- * @dataProvider get_conversation_counts_test_cases()
+ * @dataProvider get_conversation_counts_test_cases
* @param array $conversationconfigs Conversations to create
* @param int $deletemessagesuser The user who is deleting the messages
* @param array $deletemessages The list of messages to delete (by index)
diff --git a/message/tests/helper_test.php b/message/tests/helper_test.php
index 06c25d40eb4..33449f62605 100644
--- a/message/tests/helper_test.php
+++ b/message/tests/helper_test.php
@@ -229,7 +229,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
- public function prevent_unclosed_html_tags_data(): array {
+ public static function prevent_unclosed_html_tags_data(): array {
return [
'Prevent unclosed html elements' => [
'Title
Paragraph
Bold', 'Title
Paragraph
Bold', true
diff --git a/mod/assign/submission/onlinetext/tests/locallib_test.php b/mod/assign/submission/onlinetext/tests/locallib_test.php
index 03f584f4032..3086d9bf001 100644
--- a/mod/assign/submission/onlinetext/tests/locallib_test.php
+++ b/mod/assign/submission/onlinetext/tests/locallib_test.php
@@ -100,7 +100,7 @@ class locallib_test extends \advanced_testcase {
*
* @return array of testcases
*/
- public function submission_is_empty_testcases() {
+ public static function submission_is_empty_testcases(): array {
return [
'Empty submission string' => ['', true],
'Empty submission null' => [null, true],
diff --git a/mod/assign/tests/custom_completion_test.php b/mod/assign/tests/custom_completion_test.php
index 87c2cc0f749..ab580126522 100644
--- a/mod/assign/tests/custom_completion_test.php
+++ b/mod/assign/tests/custom_completion_test.php
@@ -54,7 +54,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
return [
'Undefined rule' => [
'somenonexistentrule', COMPLETION_DISABLED, false, null, coding_exception::class
@@ -200,7 +200,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_available_custom_rules_provider(): array {
+ public static function get_available_custom_rules_provider(): array {
return [
'Completion submit available' => [
COMPLETION_ENABLED, ['completionsubmit']
diff --git a/mod/assign/tests/dates_test.php b/mod/assign/tests/dates_test.php
index e1927160e65..34a54760558 100644
--- a/mod/assign/tests/dates_test.php
+++ b/mod/assign/tests/dates_test.php
@@ -43,7 +43,7 @@ class dates_test extends advanced_testcase {
* Data provider for get_dates_for_module().
* @return array[]
*/
- public function get_dates_for_module_provider(): array {
+ public static function get_dates_for_module_provider(): array {
$now = time();
$before = $now - DAYSECS;
$earlier = $before - DAYSECS;
diff --git a/mod/assign/tests/downloader_test.php b/mod/assign/tests/downloader_test.php
index 2404593289b..5f35c1ed06d 100644
--- a/mod/assign/tests/downloader_test.php
+++ b/mod/assign/tests/downloader_test.php
@@ -178,9 +178,9 @@ class downloader_test extends \advanced_testcase {
*
* @return array of scenarios
*/
- public function load_filelist_provider(): array {
- $downloadasfoldertests = $this->load_filelist_downloadasfolder_scenarios();
- $downloadasfilestests = $this->load_filelist_downloadasfiles_scenarios();
+ public static function load_filelist_provider(): array {
+ $downloadasfoldertests = static::load_filelist_downloadasfolder_scenarios();
+ $downloadasfilestests = static::load_filelist_downloadasfiles_scenarios();
return array_merge(
$downloadasfoldertests,
$downloadasfilestests,
@@ -195,8 +195,8 @@ class downloader_test extends \advanced_testcase {
*
* @return array of scenarios
*/
- private function load_filelist_downloadasfiles_scenarios(): array {
- $result = $this->load_filelist_downloadasfolder_scenarios("Download as files:");
+ private static function load_filelist_downloadasfiles_scenarios(): array {
+ $result = static::load_filelist_downloadasfolder_scenarios("Download as files:");
// Transform paths from files.
foreach ($result as $scenario => $info) {
$info['downloadasfolder'] = false;
@@ -214,7 +214,9 @@ class downloader_test extends \advanced_testcase {
* @param string $prefix the scenarios prefix
* @return array of scenarios
*/
- private function load_filelist_downloadasfolder_scenarios(string $prefix = "Download as folders:"): array {
+ private static function load_filelist_downloadasfolder_scenarios(
+ string $prefix = "Download as folders:",
+ ): array {
return [
// Test without team submissions.
$prefix . ' All users without groups' => [
diff --git a/mod/assign/tests/externallib_test.php b/mod/assign/tests/externallib_test.php
index b950938aa0c..0d56d9b1ced 100644
--- a/mod/assign/tests/externallib_test.php
+++ b/mod/assign/tests/externallib_test.php
@@ -2771,7 +2771,7 @@ class externallib_test extends \mod_assign\externallib_advanced_testcase {
/**
* The test_get_participant_relative_dates data provider.
*/
- public function get_participant_relative_dates_provider() {
+ public static function get_participant_relative_dates_provider(): array {
$timenow = time();
return [
diff --git a/mod/bigbluebuttonbn/tests/backup_restore_test.php b/mod/bigbluebuttonbn/tests/backup_restore_test.php
index b1a642c7458..5af29b6f38a 100644
--- a/mod/bigbluebuttonbn/tests/backup_restore_test.php
+++ b/mod/bigbluebuttonbn/tests/backup_restore_test.php
@@ -223,7 +223,7 @@ class backup_restore_test extends restore_date_testcase {
* Return an array of BigBlueButton types
* @return array[]
*/
- public function bbb_type_provider() {
+ public static function bbb_type_provider(): array {
return [
'All' => [instance::TYPE_ALL],
'Recording Only' => [instance::TYPE_RECORDING_ONLY],
diff --git a/mod/bigbluebuttonbn/tests/completion/completion_test.php b/mod/bigbluebuttonbn/tests/completion/completion_test.php
index 79e55d4326e..668726e14ee 100644
--- a/mod/bigbluebuttonbn/tests/completion/completion_test.php
+++ b/mod/bigbluebuttonbn/tests/completion/completion_test.php
@@ -280,7 +280,7 @@ class completion_test extends \advanced_testcase {
*
* @return array[]
*/
- public function custom_completion_data_provider() {
+ public static function custom_completion_data_provider(): array {
return [
'simple' => [
'customcompletionrules' => [
diff --git a/mod/bigbluebuttonbn/tests/external/get_recordings_test.php b/mod/bigbluebuttonbn/tests/external/get_recordings_test.php
index ddda640e7cd..0f54f61b997 100644
--- a/mod/bigbluebuttonbn/tests/external/get_recordings_test.php
+++ b/mod/bigbluebuttonbn/tests/external/get_recordings_test.php
@@ -421,7 +421,7 @@ class get_recordings_test extends \externallib_advanced_testcase {
*
* @return array[]
*/
- public function recording_group_test_data() {
+ public static function recording_group_test_data(): array {
return [
'visiblegroups' => [
'type' => instance::TYPE_ALL,
diff --git a/mod/bigbluebuttonbn/tests/instance_test.php b/mod/bigbluebuttonbn/tests/instance_test.php
index 321a10579d3..818757aadc2 100644
--- a/mod/bigbluebuttonbn/tests/instance_test.php
+++ b/mod/bigbluebuttonbn/tests/instance_test.php
@@ -65,7 +65,7 @@ class instance_test extends advanced_testcase {
*
* @return string[][]
*/
- public function get_from_location_provider(): array {
+ public static function get_from_location_provider(): array {
return [
['get_from_instanceid', 'id'],
['get_from_cmid', 'cmid'],
@@ -204,7 +204,7 @@ class instance_test extends advanced_testcase {
*
* @return \string[][]
*/
- public function invalid_meetingid_provider(): array {
+ public static function invalid_meetingid_provider(): array {
// Meeting IDs are in the formats:
// - --
// - --[]
@@ -314,7 +314,7 @@ class instance_test extends advanced_testcase {
*
* @return array
*/
- public function is_currently_open_provider(): array {
+ public static function is_currently_open_provider(): array {
return [
'No opening or closing time set: Is open' => [null, null, true],
'Opening time set in the past, no closing: Is open' => [-DAYSECS, null, true],
@@ -393,7 +393,7 @@ class instance_test extends advanced_testcase {
*
* @return array
*/
- public function user_must_wait_to_join_provider(): array {
+ public static function user_must_wait_to_join_provider(): array {
return [
'Admins must never wait to join (waiting disabled)' => [true, false, false, false],
'Admins must never wait to join (waiting enabled)' => [true, false, true, false],
@@ -437,7 +437,7 @@ class instance_test extends advanced_testcase {
*
* @return array
*/
- public function does_current_user_count_towards_user_limit_provider(): array {
+ public static function does_current_user_count_towards_user_limit_provider(): array {
return [
'Admin does not count' => [true, false, false],
'Moderator does not count' => [false, true, false],
@@ -482,7 +482,7 @@ class instance_test extends advanced_testcase {
*
* @return array
*/
- public function get_current_user_password_provider(): array {
+ public static function get_current_user_password_provider(): array {
return [
'Admin is a moderator' => [true, false, true],
'Moderator is a moderator' => [false, true, true],
@@ -523,7 +523,7 @@ class instance_test extends advanced_testcase {
*
* @return array
*/
- public function get_current_user_role_provider(): array {
+ public static function get_current_user_role_provider(): array {
return [
'Admin is a moderator' => [true, false, true],
'Moderator is a moderator' => [false, true, true],
@@ -564,7 +564,7 @@ class instance_test extends advanced_testcase {
*
* @return array
*/
- public function allow_recording_start_stop_provider(): array {
+ public static function allow_recording_start_stop_provider(): array {
return [
'Meeting is not recorded: No start/stop' => [false, false, false],
'Meeting recorded, Buttons shown: Allow' => [true, true, true],
diff --git a/mod/bigbluebuttonbn/tests/local/bigbluebutton/recordings/recording_data_test.php b/mod/bigbluebuttonbn/tests/local/bigbluebutton/recordings/recording_data_test.php
index d4d5d503754..1e2a5660dc1 100644
--- a/mod/bigbluebuttonbn/tests/local/bigbluebutton/recordings/recording_data_test.php
+++ b/mod/bigbluebuttonbn/tests/local/bigbluebutton/recordings/recording_data_test.php
@@ -44,7 +44,7 @@ class recording_data_test extends \advanced_testcase {
*
* @return \string[][]
*/
- public function type_text_provider(): array {
+ public static function type_text_provider(): array {
return [
['Presentation', 'presentation'],
['Video', 'video'],
diff --git a/mod/bigbluebuttonbn/tests/local/extension_test.php b/mod/bigbluebuttonbn/tests/local/extension_test.php
index 874f96c31ef..375cb7284b2 100644
--- a/mod/bigbluebuttonbn/tests/local/extension_test.php
+++ b/mod/bigbluebuttonbn/tests/local/extension_test.php
@@ -423,7 +423,7 @@ class extension_test extends \advanced_testcase {
*
* @return array[]
*/
- public function classes_implementing_class(): array {
+ public static function classes_implementing_class(): array {
return [
'mod_instance_helper with plugin disabled' => [
'bbbenabled' => false,
diff --git a/mod/bigbluebuttonbn/tests/meeting_test.php b/mod/bigbluebuttonbn/tests/meeting_test.php
index 06e5f7d124e..d9a6ac7ad92 100644
--- a/mod/bigbluebuttonbn/tests/meeting_test.php
+++ b/mod/bigbluebuttonbn/tests/meeting_test.php
@@ -57,7 +57,7 @@ class meeting_test extends \advanced_testcase {
*
* @return array[]
*/
- public function get_instance_types_meeting_info(): array {
+ public static function get_instance_types_meeting_info(): array {
return [
'Instance Type ALL - No Group' => [
'type' => instance::TYPE_ALL,
@@ -417,7 +417,7 @@ class meeting_test extends \advanced_testcase {
*
* @return array[]
*/
- public function get_data_can_join_with_dates(): array {
+ public static function get_data_can_join_with_dates(): array {
return [
'Instance Type ALL - No Group - Closed in past' => [
'type' => instance::TYPE_ALL,
diff --git a/mod/bigbluebuttonbn/tests/output/recording_row_playback_test.php b/mod/bigbluebuttonbn/tests/output/recording_row_playback_test.php
index 194dcc3adce..8d35f6debb6 100644
--- a/mod/bigbluebuttonbn/tests/output/recording_row_playback_test.php
+++ b/mod/bigbluebuttonbn/tests/output/recording_row_playback_test.php
@@ -130,7 +130,7 @@ class recording_row_playback_test extends \advanced_testcase {
*
* @return array
*/
- public function should_be_included_data_provider() {
+ public static function should_be_included_data_provider(): array {
return [
'editingteacher user should see all' => [
'role' => 'editingteacher',
diff --git a/mod/bigbluebuttonbn/tests/recording_test.php b/mod/bigbluebuttonbn/tests/recording_test.php
index de68bcee745..76376115282 100644
--- a/mod/bigbluebuttonbn/tests/recording_test.php
+++ b/mod/bigbluebuttonbn/tests/recording_test.php
@@ -103,7 +103,7 @@ class recording_test extends \advanced_testcase {
*
* @return array[]
*/
- public function get_status_provider(): array {
+ public static function get_status_provider(): array {
return [
[recording::RECORDING_STATUS_PROCESSED],
[recording::RECORDING_STATUS_DISMISSED],
@@ -137,7 +137,7 @@ class recording_test extends \advanced_testcase {
*
* @return array[]
*/
- public function get_allrecordings_types_provider(): array {
+ public static function get_allrecordings_types_provider(): array {
return [
'Instance Type ALL' => [
'type' => instance::TYPE_ALL
diff --git a/mod/chat/tests/format_message_test.php b/mod/chat/tests/format_message_test.php
index aa36b66aeef..882ee8a6fbc 100644
--- a/mod/chat/tests/format_message_test.php
+++ b/mod/chat/tests/format_message_test.php
@@ -33,7 +33,7 @@ class format_message_test extends \advanced_testcase {
const USER_CURRENT = 1;
const USER_OTHER = 2;
- public function chat_format_message_manually_provider() {
+ public static function chat_format_message_manually_provider(): array {
$dateregexp = '\d{2}:\d{2}';
return [
'Beep everyone' => [
diff --git a/mod/choice/tests/custom_completion_test.php b/mod/choice/tests/custom_completion_test.php
index 98595248072..a8780f82bd1 100644
--- a/mod/choice/tests/custom_completion_test.php
+++ b/mod/choice/tests/custom_completion_test.php
@@ -43,7 +43,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
return [
'Undefined rule' => [
'somenonexistentrule', COMPLETION_DISABLED, false, null, coding_exception::class
@@ -166,7 +166,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_available_custom_rules_provider(): array {
+ public static function get_available_custom_rules_provider(): array {
return [
'Completion submit available' => [
COMPLETION_ENABLED, ['completionsubmit']
diff --git a/mod/choice/tests/dates_test.php b/mod/choice/tests/dates_test.php
index b5c0d27f92e..dd6eab7d692 100644
--- a/mod/choice/tests/dates_test.php
+++ b/mod/choice/tests/dates_test.php
@@ -43,7 +43,7 @@ class dates_test extends advanced_testcase {
* Data provider for get_dates_for_module().
* @return array[]
*/
- public function get_dates_for_module_provider(): array {
+ public static function get_dates_for_module_provider(): array {
$now = time();
$before = $now - DAYSECS;
$earlier = $before - DAYSECS;
diff --git a/mod/data/tests/custom_completion_test.php b/mod/data/tests/custom_completion_test.php
index d1c758e1b14..a3a6e1fbd54 100644
--- a/mod/data/tests/custom_completion_test.php
+++ b/mod/data/tests/custom_completion_test.php
@@ -51,7 +51,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
return [
'Undefined rule' => [
'somenonexistentrule', COMPLETION_DISABLED, 0, null, coding_exception::class
@@ -173,7 +173,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_available_custom_rules_provider(): array {
+ public static function get_available_custom_rules_provider(): array {
return [
'Completion entries available' => [
COMPLETION_ENABLED, ['completionentries']
diff --git a/mod/data/tests/dates_test.php b/mod/data/tests/dates_test.php
index edd2fbd38b1..34136ccb843 100644
--- a/mod/data/tests/dates_test.php
+++ b/mod/data/tests/dates_test.php
@@ -43,7 +43,7 @@ class dates_test extends advanced_testcase {
* Data provider for get_dates_for_module().
* @return array[]
*/
- public function get_dates_for_module_provider(): array {
+ public static function get_dates_for_module_provider(): array {
$now = time();
$before = $now - DAYSECS;
$earlier = $before - DAYSECS;
diff --git a/mod/data/tests/entries_exporter_test.php b/mod/data/tests/entries_exporter_test.php
index 2e30875773e..7ae23c30f6c 100644
--- a/mod/data/tests/entries_exporter_test.php
+++ b/mod/data/tests/entries_exporter_test.php
@@ -56,7 +56,7 @@ class entries_exporter_test extends \advanced_testcase {
*
* @return array data for testing
*/
- public function get_records_count_provider(): array {
+ public static function get_records_count_provider(): array {
return [
'onlyheader' => [
'rows' => [
@@ -109,7 +109,7 @@ class entries_exporter_test extends \advanced_testcase {
*
* @return array data for testing
*/
- public function add_file_from_string_provider(): array {
+ public static function add_file_from_string_provider(): array {
return [
'one file' => [
'files' => [
@@ -187,7 +187,7 @@ class entries_exporter_test extends \advanced_testcase {
*
* @return array data for testing
*/
- public function create_unique_filename_provider(): array {
+ public static function create_unique_filename_provider(): array {
return [
'does not exist yet' => [
'inputfilename' => 'someuniquename.txt',
diff --git a/mod/data/tests/entries_import_test.php b/mod/data/tests/entries_import_test.php
index 416207bd98a..4390505b994 100644
--- a/mod/data/tests/entries_import_test.php
+++ b/mod/data/tests/entries_import_test.php
@@ -463,7 +463,7 @@ final class entries_import_test extends \advanced_testcase {
*
* @return array data for testing
*/
- public function get_added_record_messages_provider(): array {
+ public static function get_added_record_messages_provider(): array {
return [
'only header' => [
'datafilecontent' => 'ID,Param2,filefield,picturefield' . PHP_EOL,
diff --git a/mod/data/tests/entries_importer_test.php b/mod/data/tests/entries_importer_test.php
index 10f11f5fc86..30b63446723 100644
--- a/mod/data/tests/entries_importer_test.php
+++ b/mod/data/tests/entries_importer_test.php
@@ -133,7 +133,7 @@ class entries_importer_test extends \advanced_testcase {
*
* @return array data for testing
*/
- public function get_file_content_from_zip_provider(): array {
+ public static function get_file_content_from_zip_provider(): array {
return [
'some files in the zip archive' => [
'files' => [
diff --git a/mod/data/tests/event/events_test.php b/mod/data/tests/event/events_test.php
index 40fdee1408f..d8deb9972d8 100644
--- a/mod/data/tests/event/events_test.php
+++ b/mod/data/tests/event/events_test.php
@@ -342,7 +342,7 @@ class events_test extends \advanced_testcase {
*
* @return array[]
*/
- public function preset_importer_provider(): array {
+ public static function preset_importer_provider(): array {
// Image gallery preset is: ['title' => 'text', 'description' => 'textarea', 'image' => 'picture'];
$titlefield = new \stdClass();
diff --git a/mod/data/tests/external/get_mapping_information_test.php b/mod/data/tests/external/get_mapping_information_test.php
index c81cb6a9510..bca3943dac3 100644
--- a/mod/data/tests/external/get_mapping_information_test.php
+++ b/mod/data/tests/external/get_mapping_information_test.php
@@ -40,7 +40,7 @@ class get_mapping_information_test extends \advanced_testcase {
*
* @return array[]
*/
- public function get_mapping_information_provider(): array {
+ public static function get_mapping_information_provider(): array {
// Image gallery preset is: ['title' => 'text', 'description' => 'textarea', 'image' => 'picture'];
$titlefield = new \stdClass();
diff --git a/mod/data/tests/generator_test.php b/mod/data/tests/generator_test.php
index 8646855f6d8..279ab081dd8 100644
--- a/mod/data/tests/generator_test.php
+++ b/mod/data/tests/generator_test.php
@@ -300,7 +300,7 @@ class generator_test extends \advanced_testcase {
*
* @return array
*/
- public function create_preset_provider(): array {
+ public static function create_preset_provider(): array {
return [
'Create using the default configuration' => [
'record' => null,
diff --git a/mod/data/tests/lib_test.php b/mod/data/tests/lib_test.php
index 8e7f9c71da6..9f7447da8ff 100644
--- a/mod/data/tests/lib_test.php
+++ b/mod/data/tests/lib_test.php
@@ -747,7 +747,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function data_get_config_provider() {
+ public static function data_get_config_provider(): array {
$initialdata = (object) [
'template_foo' => true,
'template_bar' => false,
@@ -838,7 +838,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function data_set_config_provider() {
+ public static function data_set_config_provider(): array {
$basevalue = (object) ['id' => rand(1, 1000)];
$config = [
'template_foo' => true,
@@ -2142,7 +2142,7 @@ class lib_test extends \advanced_testcase {
*
* @return array of scenarios
*/
- public function data_append_new_field_to_templates_provider(): array {
+ public static function data_append_new_field_to_templates_provider(): array {
return [
'Plain template' => [
'hasfield' => false,
diff --git a/mod/data/tests/manager_test.php b/mod/data/tests/manager_test.php
index 3fae83e2d86..a2fbb5f6082 100644
--- a/mod/data/tests/manager_test.php
+++ b/mod/data/tests/manager_test.php
@@ -482,7 +482,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function can_view_preset_provider(): array {
+ public static function can_view_preset_provider(): array {
return [
// User presets.
'Teacher owned preset without user id param' => [
@@ -737,7 +737,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function reset_template_provider(): array {
+ public static function reset_template_provider(): array {
return [
// User presets.
'listtemplate' => [
diff --git a/mod/data/tests/preset_importer_test.php b/mod/data/tests/preset_importer_test.php
index 6c979ff3f4b..6c91685d39a 100644
--- a/mod/data/tests/preset_importer_test.php
+++ b/mod/data/tests/preset_importer_test.php
@@ -28,14 +28,13 @@ use mod_data\local\importer\preset_importer;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @coversDefaultClass \mod_data\local\importer\preset_importer
*/
-class preset_importer_test extends \advanced_testcase {
-
+final class preset_importer_test extends \advanced_testcase {
/**
* Data provider for build providers for test_needs_mapping and test_set_affected_fields.
*
* @return array[]
*/
- public function preset_importer_provider(): array {
+ public static function preset_importer_provider(): array {
// Image gallery preset is: ['title' => 'text', 'description' => 'textarea', 'image' => 'picture'];
$titlefield = new \stdClass();
@@ -107,8 +106,8 @@ class preset_importer_test extends \advanced_testcase {
*
* @return array[]
*/
- public function needs_mapping_provider(): array {
- $basedprovider = $this->preset_importer_provider();
+ public static function needs_mapping_provider(): array {
+ $basedprovider = static::preset_importer_provider();
$basedprovider['Empty database / Empty importer']['needsmapping'] = false;
$basedprovider['Empty database / Importer with fields']['needsmapping'] = false;
@@ -182,8 +181,8 @@ class preset_importer_test extends \advanced_testcase {
*
* @return array[]
*/
- public function set_affected_provider(): array {
- $basedprovider = $this->preset_importer_provider();
+ public static function set_affected_provider(): array {
+ $basedprovider = static::preset_importer_provider();
$basedprovider['Empty database / Empty importer']['fieldstocreate'] = 0;
$basedprovider['Empty database / Empty importer']['fieldstoremove'] = 0;
@@ -353,7 +352,7 @@ class preset_importer_test extends \advanced_testcase {
*
* @return array[]
*/
- public function get_field_names_provider(): array {
+ public static function get_field_names_provider(): array {
return [
'Empty list' => [
'fields' => [],
diff --git a/mod/data/tests/preset_test.php b/mod/data/tests/preset_test.php
index 163bfd09545..6a4872fc2c1 100644
--- a/mod/data/tests/preset_test.php
+++ b/mod/data/tests/preset_test.php
@@ -495,7 +495,7 @@ class preset_test extends \advanced_testcase {
*
* @return array
*/
- public function is_directory_a_preset_provider(): array {
+ public static function is_directory_a_preset_provider(): array {
global $CFG;
return [
@@ -607,7 +607,7 @@ class preset_test extends \advanced_testcase {
*
* @return array
*/
- public function generate_preset_xml_provider(): array {
+ public static function generate_preset_xml_provider(): array {
return [
'Generate preset.xml with the default params and empty description' => [
'params' => [],
diff --git a/mod/data/tests/template_test.php b/mod/data/tests/template_test.php
index b180d201d93..7cd6c286eaa 100644
--- a/mod/data/tests/template_test.php
+++ b/mod/data/tests/template_test.php
@@ -173,7 +173,7 @@ class template_test extends \advanced_testcase {
*
* @return array of scenarios
*/
- public function parse_entries_provider(): array {
+ public static function parse_entries_provider(): array {
return [
// Teacher scenarios.
'Teacher id tag' => [
@@ -928,7 +928,7 @@ class template_test extends \advanced_testcase {
*
* @return array of scenarios
*/
- public function parse_add_entry_provider(): array {
+ public static function parse_add_entry_provider(): array {
return [
// Editing an entry.
'Teacher editing entry tags tag' => [
diff --git a/mod/feedback/tests/custom_completion_test.php b/mod/feedback/tests/custom_completion_test.php
index bb16c875299..87aec3e8de9 100644
--- a/mod/feedback/tests/custom_completion_test.php
+++ b/mod/feedback/tests/custom_completion_test.php
@@ -51,7 +51,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
return [
'Undefined rule' => [
'somenonexistentrule', COMPLETION_DISABLED, false, null, coding_exception::class
@@ -174,7 +174,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_available_custom_rules_provider(): array {
+ public static function get_available_custom_rules_provider(): array {
return [
'Completion submit available' => [
COMPLETION_ENABLED, ['completionsubmit']
diff --git a/mod/feedback/tests/dates_test.php b/mod/feedback/tests/dates_test.php
index 99db1283852..f7dbe5365d2 100644
--- a/mod/feedback/tests/dates_test.php
+++ b/mod/feedback/tests/dates_test.php
@@ -43,7 +43,7 @@ class dates_test extends advanced_testcase {
* Data provider for get_dates_for_module().
* @return array[]
*/
- public function get_dates_for_module_provider(): array {
+ public static function get_dates_for_module_provider(): array {
$now = time();
$before = $now - DAYSECS;
$earlier = $before - DAYSECS;
diff --git a/mod/feedback/tests/form/create_template_form_test.php b/mod/feedback/tests/form/create_template_form_test.php
index dfb7b02958f..a86c099ec39 100644
--- a/mod/feedback/tests/form/create_template_form_test.php
+++ b/mod/feedback/tests/form/create_template_form_test.php
@@ -102,7 +102,7 @@ class create_template_form_test extends \advanced_testcase {
*
* @return array
*/
- public function createtemplate_form_with_modified_capabilities_provider(): array {
+ public static function createtemplate_form_with_modified_capabilities_provider(): array {
return [
"Manager without edititems permission cannot create any templates" => [
['mod/feedback:edititems'], false
@@ -180,7 +180,7 @@ class create_template_form_test extends \advanced_testcase {
*
* @return array
*/
- public function createtemplate_form_provider(): array {
+ public static function createtemplate_form_provider(): array {
return [
'Create a private template as an admin' => [
'admin', false
diff --git a/mod/feedback/tests/form/use_template_form_test.php b/mod/feedback/tests/form/use_template_form_test.php
index 5217617cee6..39b9c07d867 100644
--- a/mod/feedback/tests/form/use_template_form_test.php
+++ b/mod/feedback/tests/form/use_template_form_test.php
@@ -100,7 +100,7 @@ class use_template_form_test extends \advanced_testcase {
*
* @return array
*/
- public function usetemplate_form_provider() {
+ public static function usetemplate_form_provider(): array {
return [
'Test submission with a private template as an admin' => [
'admin', true, true
diff --git a/mod/folder/tests/lib_test.php b/mod/folder/tests/lib_test.php
index d802496907a..e0929aaca2b 100644
--- a/mod/folder/tests/lib_test.php
+++ b/mod/folder/tests/lib_test.php
@@ -378,7 +378,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function folder_get_recent_mod_activity_provider(): array {
+ public static function folder_get_recent_mod_activity_provider(): array {
return [
'Teacher with force download' => [
'forcedownload' => 1,
diff --git a/mod/forum/tests/backup_forum_activity_task_test.php b/mod/forum/tests/backup_forum_activity_task_test.php
index a469cd2e0c6..ad5876e6add 100644
--- a/mod/forum/tests/backup_forum_activity_task_test.php
+++ b/mod/forum/tests/backup_forum_activity_task_test.php
@@ -49,7 +49,7 @@ class backup_forum_activity_task_test extends \advanced_testcase {
$this->assertEquals($expectation, backup_forum_activity_task::encode_content_links($content));
}
- public function encode_content_links_provider() {
+ public static function encode_content_links_provider(): array {
global $CFG;
$altwwwroot = 'http://invalid.example.com/';
return [
diff --git a/mod/forum/tests/custom_completion_test.php b/mod/forum/tests/custom_completion_test.php
index df09f15a73d..860278dd506 100644
--- a/mod/forum/tests/custom_completion_test.php
+++ b/mod/forum/tests/custom_completion_test.php
@@ -55,7 +55,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
return [
'Undefined rule' => [
'somenonexistentrule', 0, COMPLETION_TRACKING_NONE, 0, 0, 0, null, coding_exception::class
@@ -214,7 +214,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_available_custom_rules_provider(): array {
+ public static function get_available_custom_rules_provider(): array {
return [
'Completion discussions available' => [
COMPLETION_ENABLED, ['completiondiscussions']
diff --git a/mod/forum/tests/dates_test.php b/mod/forum/tests/dates_test.php
index 4534a51bfc7..eb7118c4cff 100644
--- a/mod/forum/tests/dates_test.php
+++ b/mod/forum/tests/dates_test.php
@@ -43,7 +43,7 @@ class dates_test extends advanced_testcase {
* Data provider for get_dates_for_module().
* @return array[]
*/
- public function get_dates_for_module_provider(): array {
+ public static function get_dates_for_module_provider(): array {
$now = time();
$before = $now - DAYSECS;
$after = $now + DAYSECS;
diff --git a/mod/forum/tests/entities_discussion_test.php b/mod/forum/tests/entities_discussion_test.php
index d2f197179e8..3bad7d2b555 100644
--- a/mod/forum/tests/entities_discussion_test.php
+++ b/mod/forum/tests/entities_discussion_test.php
@@ -159,7 +159,7 @@ class entities_discussion_test extends \advanced_testcase {
*
* @return array start/end time offsets and the expected results.
*/
- public function diplay_period_options_provider() {
+ public static function diplay_period_options_provider(): array {
return array(
["No dates set", 0, 0, true, false, true],
["Only started date in the future", 100, 0, false, false, false],
diff --git a/mod/forum/tests/exporters_post_test.php b/mod/forum/tests/exporters_post_test.php
index 20e46be5fb9..d97d3f034a2 100644
--- a/mod/forum/tests/exporters_post_test.php
+++ b/mod/forum/tests/exporters_post_test.php
@@ -201,7 +201,7 @@ class exporters_post_test extends \advanced_testcase {
*
* @return array
*/
- public function export_post_provider(): array {
+ public static function export_post_provider(): array {
return [
'Simple export' => [
],
diff --git a/mod/forum/tests/grade/forum_gradeitem_test.php b/mod/forum/tests/grade/forum_gradeitem_test.php
index 86d9c6ee1d8..3d62c316ea1 100644
--- a/mod/forum/tests/grade/forum_gradeitem_test.php
+++ b/mod/forum/tests/grade/forum_gradeitem_test.php
@@ -216,7 +216,7 @@ class forum_gradeitem_test extends \advanced_testcase {
*
* @return array
*/
- public function should_grade_only_active_users_provider(): array {
+ public static function should_grade_only_active_users_provider(): array {
return [
'Enabled showonlyactiveenrol setting; enabled showonlyactiveenrol preference; view suspended users capability' =>
[
diff --git a/mod/forum/tests/grade/gradeitems_test.php b/mod/forum/tests/grade/gradeitems_test.php
index 404791ac8a4..1bbe060d919 100644
--- a/mod/forum/tests/grade/gradeitems_test.php
+++ b/mod/forum/tests/grade/gradeitems_test.php
@@ -77,7 +77,7 @@ class gradeitems_test extends advanced_testcase {
*
* @return array
*/
- public function is_advancedgrading_itemname_provider(): array {
+ public static function is_advancedgrading_itemname_provider(): array {
return [
'rating is not advanced' => [
'rating',
diff --git a/mod/forum/tests/h5p/canedit_test.php b/mod/forum/tests/h5p/canedit_test.php
index 1973bf8eeb6..2602f615fd3 100644
--- a/mod/forum/tests/h5p/canedit_test.php
+++ b/mod/forum/tests/h5p/canedit_test.php
@@ -123,7 +123,7 @@ class canedit_test extends \advanced_testcase {
*
* @return array
*/
- public function can_edit_content_provider(): array {
+ public static function can_edit_content_provider(): array {
return [
// Component = mod_forum.
'mod_forum: Admin user is author' => [
diff --git a/mod/forum/tests/lib_test.php b/mod/forum/tests/lib_test.php
index 2fc6382975c..8d80b1abef0 100644
--- a/mod/forum/tests/lib_test.php
+++ b/mod/forum/tests/lib_test.php
@@ -3271,7 +3271,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function forum_discussion_is_locked_provider() {
+ public static function forum_discussion_is_locked_provider(): array {
return [
'Unlocked: lockdiscussionafter is false' => [
['lockdiscussionafter' => false],
@@ -3325,7 +3325,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function forum_is_cutoff_date_reached_provider() {
+ public static function forum_is_cutoff_date_reached_provider(): array {
$now = time();
return [
'cutoffdate is unset' => [
@@ -3373,7 +3373,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function forum_is_due_date_reached_provider() {
+ public static function forum_is_due_date_reached_provider(): array {
$now = time();
return [
'duedate is unset' => [
@@ -4120,7 +4120,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function forum_check_throttling_early_returns_provider() {
+ public static function forum_check_throttling_early_returns_provider(): array {
return [
'Empty blockafter' => [(object)['id' => 1, 'course' => SITEID, 'blockafter' => 0]],
'Empty blockperiod' => [(object)['id' => 1, 'course' => SITEID, 'blockafter' => DAYSECS, 'blockperiod' => 0]],
@@ -4143,7 +4143,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function forum_check_throttling_early_exceptions_provider() {
+ public static function forum_check_throttling_early_exceptions_provider(): array {
return [
'Non-object forum' => ['a'],
'Forum ID not set' => [(object)['id' => false]],
diff --git a/mod/forum/tests/mail_test.php b/mod/forum/tests/mail_test.php
index 6a844fce264..d885c9fda20 100644
--- a/mod/forum/tests/mail_test.php
+++ b/mod/forum/tests/mail_test.php
@@ -996,7 +996,7 @@ class mail_test extends \advanced_testcase {
/**
* dataProvider for test_forum_post_email_templates().
*/
- public function forum_post_email_templates_provider() {
+ public static function forum_post_email_templates_provider(): array {
// Base information, we'll build variations based on it.
$base = array(
'user' => array('firstname' => 'Love', 'lastname' => 'Moodle', 'mailformat' => 0, 'maildigest' => 0),
diff --git a/mod/forum/tests/output_email_test.php b/mod/forum/tests/output_email_test.php
index 5ae26143093..81b0f482d7f 100644
--- a/mod/forum/tests/output_email_test.php
+++ b/mod/forum/tests/output_email_test.php
@@ -29,7 +29,7 @@ class output_email_test extends \advanced_testcase {
/**
* Data provider for the postdate function tests.
*/
- public function postdate_provider() {
+ public static function postdate_provider(): array {
return array(
'Timed discussions disabled, timestart unset' => array(
'globalconfig' => array(
diff --git a/mod/forum/tests/subscriptions_test.php b/mod/forum/tests/subscriptions_test.php
index 8817d208c93..8ec9d6652b0 100644
--- a/mod/forum/tests/subscriptions_test.php
+++ b/mod/forum/tests/subscriptions_test.php
@@ -1355,7 +1355,7 @@ class subscriptions_test extends \advanced_testcase {
$this->assertGreaterThan($suppliedcmcount, $calculatedcmcount);
}
- public function is_subscribable_forums() {
+ public static function is_subscribable_forums(): array {
return [
[
'forcesubscribe' => FORUM_DISALLOWSUBSCRIBE,
@@ -1372,9 +1372,9 @@ class subscriptions_test extends \advanced_testcase {
];
}
- public function is_subscribable_provider() {
+ public static function is_subscribable_provider(): array {
$data = [];
- foreach ($this->is_subscribable_forums() as $forum) {
+ foreach (self::is_subscribable_forums() as $forum) {
$data[] = [$forum];
}
@@ -1413,7 +1413,7 @@ class subscriptions_test extends \advanced_testcase {
$this->assertFalse(\mod_forum\subscriptions::is_subscribable($forum));
}
- public function is_subscribable_loggedin_provider() {
+ public static function is_subscribable_loggedin_provider(): array {
return [
[
['forcesubscribe' => FORUM_DISALLOWSUBSCRIBE],
diff --git a/mod/glossary/tests/custom_completion_test.php b/mod/glossary/tests/custom_completion_test.php
index 8d7af54caf0..8bb886566d3 100644
--- a/mod/glossary/tests/custom_completion_test.php
+++ b/mod/glossary/tests/custom_completion_test.php
@@ -51,7 +51,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
return [
'Undefined rule' => [
'somenonexistentrule', COMPLETION_DISABLED, 0, null, coding_exception::class
@@ -174,7 +174,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_available_custom_rules_provider(): array {
+ public static function get_available_custom_rules_provider(): array {
return [
'Completion submit available' => [
COMPLETION_ENABLED, ['completionentries']
diff --git a/mod/h5pactivity/tests/event/report_viewed_test.php b/mod/h5pactivity/tests/event/report_viewed_test.php
index 9b71f6a4bc4..5fc658c0357 100644
--- a/mod/h5pactivity/tests/event/report_viewed_test.php
+++ b/mod/h5pactivity/tests/event/report_viewed_test.php
@@ -114,7 +114,7 @@ class report_viewed_test extends advanced_testcase {
*
* @return array
*/
- public function report_viewed_data(): array {
+ public static function report_viewed_data(): array {
return [
// Exception cases.
'Event withour other data (exception)' => [
diff --git a/mod/h5pactivity/tests/external/get_attempts_test.php b/mod/h5pactivity/tests/external/get_attempts_test.php
index 37529651fad..a519e3a59ce 100644
--- a/mod/h5pactivity/tests/external/get_attempts_test.php
+++ b/mod/h5pactivity/tests/external/get_attempts_test.php
@@ -154,7 +154,7 @@ class get_attempts_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function execute_data(): array {
+ public static function execute_data(): array {
return [
// Teacher checking a user with attempts.
'Manual grade, Teacher asking participant with attempts' => [
@@ -458,7 +458,7 @@ class get_attempts_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function execute_multipleusers_data(): array {
+ public static function execute_multipleusers_data(): array {
return [
// Teacher checks.
'Teacher checking students with attempts' => [
diff --git a/mod/h5pactivity/tests/external/get_h5pactivity_access_information_test.php b/mod/h5pactivity/tests/external/get_h5pactivity_access_information_test.php
index e4667133a20..c172c343cf4 100644
--- a/mod/h5pactivity/tests/external/get_h5pactivity_access_information_test.php
+++ b/mod/h5pactivity/tests/external/get_h5pactivity_access_information_test.php
@@ -90,7 +90,7 @@ class get_h5pactivity_access_information_test extends externallib_advanced_testc
*
* @return array
*/
- public function get_h5pactivity_access_information_data(): array {
+ public static function get_h5pactivity_access_information_data(): array {
return [
'Admin, tracking enabled' => [
'', 1, ['canview', 'canreviewattempts', 'canaddinstance']
diff --git a/mod/h5pactivity/tests/external/get_results_test.php b/mod/h5pactivity/tests/external/get_results_test.php
index fffa4f3a16d..315240d7f4d 100644
--- a/mod/h5pactivity/tests/external/get_results_test.php
+++ b/mod/h5pactivity/tests/external/get_results_test.php
@@ -146,7 +146,7 @@ class get_results_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function execute_data(): array {
+ public static function execute_data(): array {
return [
'Teacher reviewing an attempt' => [
1, manager::REVIEWCOMPLETION, 'editingteacher', 'student', true, 1
@@ -277,7 +277,7 @@ class get_results_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function execute_multipleattempts_data(): array {
+ public static function execute_multipleattempts_data(): array {
return [
// Teacher cases.
'Teacher reviewing students attempts' => [
@@ -408,7 +408,7 @@ class get_results_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function execute_mixactivities_data(): array {
+ public static function execute_mixactivities_data(): array {
return [
// Teacher cases.
'Correct activity id' => [
diff --git a/mod/h5pactivity/tests/external/get_user_attempts_test.php b/mod/h5pactivity/tests/external/get_user_attempts_test.php
index 2f0a344d7cb..cfe51ba6dd1 100644
--- a/mod/h5pactivity/tests/external/get_user_attempts_test.php
+++ b/mod/h5pactivity/tests/external/get_user_attempts_test.php
@@ -145,7 +145,7 @@ class get_user_attempts_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function execute_multipleusers_data(): array {
+ public static function execute_multipleusers_data(): array {
return [
// Teacher checks.
'Teacher checking students with attempts' => [
@@ -188,7 +188,7 @@ class get_user_attempts_test extends externallib_advanced_testcase {
*
* @return array[]
*/
- public function execute_with_sortorder(): array {
+ public static function execute_with_sortorder(): array {
return [
'Sort by id' => ['id', ['user01', 'user02']],
'Sort by id desc' => ['id desc', ['user02', 'user01']],
diff --git a/mod/h5pactivity/tests/local/attempt_test.php b/mod/h5pactivity/tests/local/attempt_test.php
index 378874854ce..58495aee163 100644
--- a/mod/h5pactivity/tests/local/attempt_test.php
+++ b/mod/h5pactivity/tests/local/attempt_test.php
@@ -180,7 +180,7 @@ class attempt_test extends \advanced_testcase {
*
* @return array
*/
- public function save_statement_data(): array {
+ public static function save_statement_data(): array {
return [
'Statement without definition and result' => [
'', false, false, [false, 0, 0, 0, 0, null, null]
@@ -312,7 +312,7 @@ class attempt_test extends \advanced_testcase {
*
* @return array
*/
- public function delete_all_attempts_data(): array {
+ public static function delete_all_attempts_data(): array {
return [
'Delete all attempts from activity' => [
false, [0, 0, 2, 2, 2, 4]
@@ -413,7 +413,7 @@ class attempt_test extends \advanced_testcase {
*
* @return array
*/
- public function basic_setters_data(): array {
+ public static function basic_setters_data(): array {
return [
'Set attempt duration' => [
'duration', 25, 35
diff --git a/mod/h5pactivity/tests/local/grader_test.php b/mod/h5pactivity/tests/local/grader_test.php
index 29a91e1107c..a3929071577 100644
--- a/mod/h5pactivity/tests/local/grader_test.php
+++ b/mod/h5pactivity/tests/local/grader_test.php
@@ -160,7 +160,7 @@ class grader_test extends \advanced_testcase {
*
* @return array
*/
- public function grade_item_update_data(): array {
+ public static function grade_item_update_data(): array {
return [
'Change idnumber' => [
100, false, 'newidnumber'
@@ -258,7 +258,7 @@ class grader_test extends \advanced_testcase {
*
* @return array
*/
- public function update_grades_data(): array {
+ public static function update_grades_data(): array {
return [
// Quantitative grade, all attempts completed.
'Same grademax, all users, all completed' => [
diff --git a/mod/h5pactivity/tests/local/manager_test.php b/mod/h5pactivity/tests/local/manager_test.php
index 6b7a740c9ec..f9781d576c4 100644
--- a/mod/h5pactivity/tests/local/manager_test.php
+++ b/mod/h5pactivity/tests/local/manager_test.php
@@ -100,7 +100,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function is_tracking_enabled_data(): array {
+ public static function is_tracking_enabled_data(): array {
return [
'Logged student, tracking enabled' => [
true, 'student', 1, true, true,
@@ -214,7 +214,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function get_users_scaled_score_data(): array {
+ public static function get_users_scaled_score_data(): array {
return [
'Tracking with max attempt method' => [
1, manager::GRADEHIGHESTATTEMPT, [1.00000, 31, 2], [0.66667, 32, 2]
@@ -291,7 +291,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function get_selected_attempt_data(): array {
+ public static function get_selected_attempt_data(): array {
return [
'Tracking with max attempt method' => [
1, manager::GRADEHIGHESTATTEMPT, manager::GRADEHIGHESTATTEMPT
@@ -400,7 +400,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function can_view_all_attempts_data(): array {
+ public static function can_view_all_attempts_data(): array {
return [
// No tracking cases.
'No tracking with admin using $USER' => [
@@ -472,7 +472,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function can_view_own_attempts_data(): array {
+ public static function can_view_own_attempts_data(): array {
return [
// No tracking cases.
'No tracking, review none, using $USER, without attempts' => [
@@ -611,7 +611,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function count_attempts_all_data(): array {
+ public static function count_attempts_all_data(): array {
return [
'Students with both view and submit capability' => [true, true, false, 6],
'Students without view but with submit capability' => [false, true, false, 0],
@@ -677,7 +677,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function get_active_users_join_data(): array {
+ public static function get_active_users_join_data(): array {
return [
'All potential users' => [
'allpotentialusers' => true,
@@ -922,7 +922,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function get_report_data(): array {
+ public static function get_report_data(): array {
return [
// No tracking scenarios.
'No tracking, review none, no attempts, teacher' => [
@@ -1057,7 +1057,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function get_report_data_groupmode(): array {
+ public static function get_report_data_groupmode(): array {
return [
// No tracking scenarios.
'course groupmode is SEPARATEGROUPS' => [false],
@@ -1115,7 +1115,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function get_attempt_data(): array {
+ public static function get_attempt_data(): array {
return [
'Get the current activity attempt' => [
'current', 'current'
diff --git a/mod/h5pactivity/tests/restore_test.php b/mod/h5pactivity/tests/restore_test.php
index d6e72f98e6c..f3c23708ffe 100644
--- a/mod/h5pactivity/tests/restore_test.php
+++ b/mod/h5pactivity/tests/restore_test.php
@@ -155,7 +155,7 @@ class restore_test extends advanced_testcase {
*
* @return array
*/
- public function backup_restore_data(): array {
+ public static function backup_restore_data(): array {
return [
'Activity attempts and restore with userdata' => [
true, true, [1, 1, 3], [1, 1, 3]
diff --git a/mod/label/tests/lib_test.php b/mod/label/tests/lib_test.php
index 17b6bcb7c21..d26493fe8f4 100644
--- a/mod/label/tests/lib_test.php
+++ b/mod/label/tests/lib_test.php
@@ -235,7 +235,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function label_get_name_data_provider(): array {
+ public static function label_get_name_data_provider(): array {
return [
'withlabelname' => [
'name' => 'Test label 1',
diff --git a/mod/lesson/tests/dates_test.php b/mod/lesson/tests/dates_test.php
index a0f7bbe383e..df4574b384d 100644
--- a/mod/lesson/tests/dates_test.php
+++ b/mod/lesson/tests/dates_test.php
@@ -43,7 +43,7 @@ class dates_test extends advanced_testcase {
* Data provider for get_dates_for_module().
* @return array[]
*/
- public function get_dates_for_module_provider(): array {
+ public static function get_dates_for_module_provider(): array {
$now = time();
$before = $now - DAYSECS;
$earlier = $before - DAYSECS;
diff --git a/mod/lesson/tests/locallib_test.php b/mod/lesson/tests/locallib_test.php
index 82561af364d..5511209a9d2 100644
--- a/mod/lesson/tests/locallib_test.php
+++ b/mod/lesson/tests/locallib_test.php
@@ -260,7 +260,7 @@ class locallib_test extends \advanced_testcase {
*
* @return array
*/
- public function get_last_attempt_dataprovider() {
+ public static function get_last_attempt_dataprovider(): array {
return [
[0, [(object)['id' => 1], (object)['id' => 2], (object)['id' => 3]], (object)['id' => 3]],
[1, [(object)['id' => 1], (object)['id' => 2], (object)['id' => 3]], (object)['id' => 1]],
diff --git a/mod/lesson/tests/numeric_helper_test.php b/mod/lesson/tests/numeric_helper_test.php
index 2e0435e43cf..e63028b34cc 100644
--- a/mod/lesson/tests/numeric_helper_test.php
+++ b/mod/lesson/tests/numeric_helper_test.php
@@ -62,7 +62,7 @@ class numeric_helper_test extends \advanced_testcase {
*
* @return array
*/
- public function lesson_unformat_dataprovider() {
+ public static function lesson_unformat_dataprovider(): array {
return [
"Using a decimal as a separator" => [
"decsep" => ".",
@@ -100,7 +100,7 @@ class numeric_helper_test extends \advanced_testcase {
*
* @return array
*/
- public function lesson_format_dataprovider() {
+ public static function lesson_format_dataprovider(): array {
return [
"Using a decimal as a separator" => [
"decsep" => ".",
diff --git a/mod/lti/tests/local/ltiopenid/jwks_helper_test.php b/mod/lti/tests/local/ltiopenid/jwks_helper_test.php
index 34c4fca98cf..d78eca8f1d6 100644
--- a/mod/lti/tests/local/ltiopenid/jwks_helper_test.php
+++ b/mod/lti/tests/local/ltiopenid/jwks_helper_test.php
@@ -66,7 +66,7 @@ class jwks_helper_test extends \basic_testcase {
* Provider for test_fix_jwks_alg.
* @return array test data.
*/
- public function jwks_alg_provider(): array {
+ public static function jwks_alg_provider(): array {
return [
// Algs already present, so no changes to input key array.
'All JWKS keys have algs set' => [
diff --git a/mod/lti/tests/locallib_test.php b/mod/lti/tests/locallib_test.php
index d2c68202e66..048731ff1e6 100644
--- a/mod/lti/tests/locallib_test.php
+++ b/mod/lti/tests/locallib_test.php
@@ -517,7 +517,7 @@ class locallib_test extends mod_lti_testcase {
*
* @return array of [urlToTest, expectedTool, allTools]
*/
- public function lti_get_best_tool_by_url_provider() {
+ public static function lti_get_best_tool_by_url_provider(): array {
$tools = [
(object) [
'name' => 'Here',
@@ -605,7 +605,7 @@ class locallib_test extends mod_lti_testcase {
// Construct the final array as required by the provider API. Each row
// of the array contains the URL to test, the expected tool, and
// the complete list of tools.
- return array_map(function($data) use ($tools) {
+ return array_map(function($data) use ($tools): array {
return [$data['url'], $data['expected'], $tools];
}, $data);
}
@@ -2020,7 +2020,7 @@ MwIDAQAB
*
* @return array[] the test case data.
*/
- public function lti_get_ims_role_provider() {
+ public static function lti_get_ims_role_provider(): array {
return [
'Student, LTI 1.1, no role switch' => [
'islti2' => false,
diff --git a/mod/lti/tests/servicelib_test.php b/mod/lti/tests/servicelib_test.php
index af7d6b073e3..66cdebf366c 100644
--- a/mod/lti/tests/servicelib_test.php
+++ b/mod/lti/tests/servicelib_test.php
@@ -47,7 +47,7 @@ class servicelib_test extends \basic_testcase {
*
* @return array
*/
- public function message_id_provider() {
+ public static function message_id_provider(): array {
$valid = <<
diff --git a/mod/quiz/accessrule/seb/tests/access_manager_test.php b/mod/quiz/accessrule/seb/tests/access_manager_test.php
index daf59d45c99..fd88a03525d 100644
--- a/mod/quiz/accessrule/seb/tests/access_manager_test.php
+++ b/mod/quiz/accessrule/seb/tests/access_manager_test.php
@@ -342,7 +342,7 @@ class access_manager_test extends \advanced_testcase {
*
* @return array
*/
- public function should_validate_basic_header_data_provider() {
+ public static function should_validate_basic_header_data_provider(): array {
return [
[settings_provider::USE_SEB_NO, false],
[settings_provider::USE_SEB_CONFIG_MANUALLY, false],
@@ -376,7 +376,7 @@ class access_manager_test extends \advanced_testcase {
*
* @return array
*/
- public function should_validate_config_key_data_provider() {
+ public static function should_validate_config_key_data_provider(): array {
return [
[settings_provider::USE_SEB_NO, false],
[settings_provider::USE_SEB_CONFIG_MANUALLY, true],
@@ -409,7 +409,7 @@ class access_manager_test extends \advanced_testcase {
*
* @return array
*/
- public function should_validate_browser_exam_key_data_provider() {
+ public static function should_validate_browser_exam_key_data_provider(): array {
return [
[settings_provider::USE_SEB_NO, false],
[settings_provider::USE_SEB_CONFIG_MANUALLY, false],
diff --git a/mod/quiz/accessrule/seb/tests/config_key_test.php b/mod/quiz/accessrule/seb/tests/config_key_test.php
index 351c3fb167f..df1d7fea828 100644
--- a/mod/quiz/accessrule/seb/tests/config_key_test.php
+++ b/mod/quiz/accessrule/seb/tests/config_key_test.php
@@ -74,7 +74,7 @@ class config_key_test extends \advanced_testcase {
*
* @return array
*/
- public function real_ck_hash_provider(): array {
+ public static function real_ck_hash_provider(): array {
return [
'unencrypted_mac2.1.4' => ['unencrypted_mac_001.seb',
'4fa9af8ec8759eb7c680752ef4ee5eaf1a860628608fccae2715d519849f9292', ''],
diff --git a/mod/quiz/accessrule/seb/tests/external/validate_quiz_access_test.php b/mod/quiz/accessrule/seb/tests/external/validate_quiz_access_test.php
index 2ff74c69e2e..dacf5437cb5 100644
--- a/mod/quiz/accessrule/seb/tests/external/validate_quiz_access_test.php
+++ b/mod/quiz/accessrule/seb/tests/external/validate_quiz_access_test.php
@@ -54,7 +54,7 @@ class validate_quiz_access_test extends \advanced_testcase {
*
* @return array
*/
- public function bad_parameters_provider(): array {
+ public static function bad_parameters_provider(): array {
return [
'no params' => [
'cmid' => null,
diff --git a/mod/quiz/accessrule/seb/tests/property_list_test.php b/mod/quiz/accessrule/seb/tests/property_list_test.php
index ab23fe88e8e..30e7d477418 100644
--- a/mod/quiz/accessrule/seb/tests/property_list_test.php
+++ b/mod/quiz/accessrule/seb/tests/property_list_test.php
@@ -304,7 +304,7 @@ class property_list_test extends \advanced_testcase {
*
* @return array Array with test data.
*/
- public function good_update_data_provider(): array {
+ public static function good_update_data_provider(): array {
return [
'Update string' => ['testKeytestValue', 'testKey', 'newValue'],
'Update bool' => ['testKey', 'testKey', false],
@@ -317,7 +317,7 @@ class property_list_test extends \advanced_testcase {
*
* @return array Array with test data.
*/
- public function bad_update_data_provider(): array {
+ public static function bad_update_data_provider(): array {
return [
'Update string with bool' => ['testKeytestValue', 'testKey', true, 'testValue',
@@ -379,7 +379,7 @@ class property_list_test extends \advanced_testcase {
*
* @return array
*/
- public function json_data_provider(): array {
+ public static function json_data_provider(): array {
$data = "blahblah";
$base64data = base64_encode($data);
diff --git a/mod/quiz/accessrule/seb/tests/quiz_settings_test.php b/mod/quiz/accessrule/seb/tests/quiz_settings_test.php
index feef8a5a21d..42c1a2abd54 100644
--- a/mod/quiz/accessrule/seb/tests/quiz_settings_test.php
+++ b/mod/quiz/accessrule/seb/tests/quiz_settings_test.php
@@ -531,7 +531,7 @@ class quiz_settings_test extends \advanced_testcase {
*
* @return array
*/
- public function bad_browser_exam_key_provider(): array {
+ public static function bad_browser_exam_key_provider(): array {
return [
'Short string' => ['fdsf434r',
'A key should be a 64-character hex string.'],
@@ -547,7 +547,7 @@ class quiz_settings_test extends \advanced_testcase {
*
* @return array Test data.
*/
- public function filter_rules_provider(): array {
+ public static function filter_rules_provider(): array {
return [
'enabled simple expessions' => [
(object) [
diff --git a/mod/quiz/accessrule/seb/tests/rule_test.php b/mod/quiz/accessrule/seb/tests/rule_test.php
index a475181f49d..bd5d13855ef 100644
--- a/mod/quiz/accessrule/seb/tests/rule_test.php
+++ b/mod/quiz/accessrule/seb/tests/rule_test.php
@@ -88,7 +88,7 @@ class rule_test extends \advanced_testcase {
*
* @return array
*/
- public function valid_form_data_provider(): array {
+ public static function valid_form_data_provider(): array {
return [
'valid seb_requiresafeexambrowser' => ['seb_requiresafeexambrowser', '0'],
'valid seb_linkquitseb0' => ['seb_linkquitseb', 'http://safeexambrowser.org/macosx'],
@@ -104,7 +104,7 @@ class rule_test extends \advanced_testcase {
*
* @return array
*/
- public function invalid_form_data_provider(): array {
+ public static function invalid_form_data_provider(): array {
return [
'invalid seb_requiresafeexambrowser' => ['seb_requiresafeexambrowser', 'Uh oh!'],
'invalid seb_linkquitseb0' => ['seb_linkquitseb', '\0'],
diff --git a/mod/quiz/accessrule/seb/tests/settings_provider_test.php b/mod/quiz/accessrule/seb/tests/settings_provider_test.php
index c0dbdeab9b4..37de343b9d6 100644
--- a/mod/quiz/accessrule/seb/tests/settings_provider_test.php
+++ b/mod/quiz/accessrule/seb/tests/settings_provider_test.php
@@ -93,7 +93,7 @@ class settings_provider_test extends \advanced_testcase {
*
* @return array
*/
- public function settings_capability_data_provider() {
+ public static function settings_capability_data_provider(): array {
$data = [];
// Build first level SEB config settings. Any of this setting let us use SEB manual config.
diff --git a/mod/quiz/accessrule/timelimit/tests/rule_test.php b/mod/quiz/accessrule/timelimit/tests/rule_test.php
index 8cefee2f334..9ef00d1ebd2 100644
--- a/mod/quiz/accessrule/timelimit/tests/rule_test.php
+++ b/mod/quiz/accessrule/timelimit/tests/rule_test.php
@@ -63,7 +63,7 @@ class rule_test extends \basic_testcase {
*
* @return array of ($timetoclose, $timelimit, $displaylimit, $actuallimit)
*/
- public function time_limit_access_rule_with_time_close_provider() {
+ public static function time_limit_access_rule_with_time_close_provider(): array {
return [
'Close time is earlier than time limit' => [1800, 3600, 3600, 1800],
'Close time is on time limit' => [3600, 3600, 3600, 3600],
diff --git a/mod/quiz/report/overview/tests/report_test.php b/mod/quiz/report/overview/tests/report_test.php
index 481ec73cbe4..19ee23a8990 100644
--- a/mod/quiz/report/overview/tests/report_test.php
+++ b/mod/quiz/report/overview/tests/report_test.php
@@ -52,7 +52,7 @@ class report_test extends \advanced_testcase {
*
* @return array the data for the test sub-cases.
*/
- public function report_sql_cases(): array {
+ public static function report_sql_cases(): array {
return [[null], ['csv']]; // Only need to test on or off, not all download types.
}
@@ -245,7 +245,7 @@ class report_test extends \advanced_testcase {
* Bands provider.
* @return array
*/
- public function get_bands_count_and_width_provider(): array {
+ public static function get_bands_count_and_width_provider(): array {
return [
[10, [20, .5]],
[20, [20, 1]],
diff --git a/mod/quiz/tests/dates_test.php b/mod/quiz/tests/dates_test.php
index 98f1b7751cc..51f0619e74c 100644
--- a/mod/quiz/tests/dates_test.php
+++ b/mod/quiz/tests/dates_test.php
@@ -43,7 +43,7 @@ class dates_test extends advanced_testcase {
* Data provider for get_dates_for_module().
* @return array[]
*/
- public function get_dates_for_module_provider(): array {
+ public static function get_dates_for_module_provider(): array {
$now = time();
$before = $now - DAYSECS;
$earlier = $before - DAYSECS;
diff --git a/mod/quiz/tests/lib_test.php b/mod/quiz/tests/lib_test.php
index f742c7109b8..07dbc02398b 100644
--- a/mod/quiz/tests/lib_test.php
+++ b/mod/quiz/tests/lib_test.php
@@ -914,7 +914,7 @@ class lib_test extends \advanced_testcase {
*
* @return array List of data sets (test cases)
*/
- public function mod_quiz_inplace_editable_provider(): array {
+ public static function mod_quiz_inplace_editable_provider(): array {
return [
'set to A1' => [1, 'A1'],
'set with HTML characters' => [2, 'A & & <-:'],
diff --git a/mod/quiz/tests/locallib_test.php b/mod/quiz/tests/locallib_test.php
index 8a85d9e9ef7..492a840117a 100644
--- a/mod/quiz/tests/locallib_test.php
+++ b/mod/quiz/tests/locallib_test.php
@@ -60,7 +60,7 @@ class locallib_test extends \advanced_testcase {
format_float(0.247, 3));
}
- public function quiz_attempt_state_data_provider() {
+ public static function quiz_attempt_state_data_provider(): array {
return [
[quiz_attempt::IN_PROGRESS, null, null, display_options::DURING],
[quiz_attempt::FINISHED, -90, null, display_options::IMMEDIATELY_AFTER],
diff --git a/mod/scorm/tests/custom_completion_test.php b/mod/scorm/tests/custom_completion_test.php
index 3540046f5cb..a3c6c03b210 100644
--- a/mod/scorm/tests/custom_completion_test.php
+++ b/mod/scorm/tests/custom_completion_test.php
@@ -44,7 +44,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
// Prepare various reusable user scorm track data used to mock various completion states/requirements.
$completionincomplete = (object) [
@@ -301,7 +301,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_available_custom_rules_provider(): array {
+ public static function get_available_custom_rules_provider(): array {
return [
'Completion status enabled only' => [
[
diff --git a/mod/scorm/tests/dates_test.php b/mod/scorm/tests/dates_test.php
index 8188621a3df..aa9fe307474 100644
--- a/mod/scorm/tests/dates_test.php
+++ b/mod/scorm/tests/dates_test.php
@@ -43,7 +43,7 @@ class dates_test extends advanced_testcase {
* Data provider for get_dates_for_module().
* @return array[]
*/
- public function get_dates_for_module_provider(): array {
+ public static function get_dates_for_module_provider(): array {
$now = time();
$before = $now - DAYSECS;
$earlier = $before - DAYSECS;
diff --git a/mod/scorm/tests/event/events_test.php b/mod/scorm/tests/event/events_test.php
index 947c2cebd2e..aae9640856e 100644
--- a/mod/scorm/tests/event/events_test.php
+++ b/mod/scorm/tests/event/events_test.php
@@ -220,7 +220,7 @@ class events_test extends \advanced_testcase {
/**
* dataProvider for test_scoreraw_submitted_event_validations().
*/
- public function get_scoreraw_submitted_event_validations() {
+ public static function get_scoreraw_submitted_event_validations(): array {
return array(
'scoreraw_submitted => missing cmielement' => array(
null, '50',
@@ -307,7 +307,7 @@ class events_test extends \advanced_testcase {
/**
* dataProvider for test_status_submitted_event_validations().
*/
- public function get_status_submitted_event_validations() {
+ public static function get_status_submitted_event_validations(): array {
return array(
'status_submitted => missing cmielement' => array(
null, 'passed',
diff --git a/mod/survey/tests/custom_completion_test.php b/mod/survey/tests/custom_completion_test.php
index d2706bd9b3e..d2bb3d9583d 100644
--- a/mod/survey/tests/custom_completion_test.php
+++ b/mod/survey/tests/custom_completion_test.php
@@ -51,7 +51,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_state_provider(): array {
+ public static function get_state_provider(): array {
return [
'Undefined rule' => [
'somenonexistentrule', COMPLETION_DISABLED, false, null, coding_exception::class
@@ -174,7 +174,7 @@ class custom_completion_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_available_custom_rules_provider(): array {
+ public static function get_available_custom_rules_provider(): array {
return [
'Completion submit available' => [
COMPLETION_ENABLED, ['completionsubmit']
diff --git a/mod/wiki/tests/wikiparser_test.php b/mod/wiki/tests/wikiparser_test.php
index f149d8f7aa1..a03f63fae58 100644
--- a/mod/wiki/tests/wikiparser_test.php
+++ b/mod/wiki/tests/wikiparser_test.php
@@ -64,7 +64,7 @@ class wikiparser_test extends \advanced_testcase {
*
* @return array
*/
- public function urls_inside_link_text_provider() {
+ public static function urls_inside_link_text_provider(): array {
return [
'creole implicit link' => [
'markup' => 'creole',
diff --git a/mod/workshop/tests/dates_test.php b/mod/workshop/tests/dates_test.php
index 7ccc15646d0..de97fc52ba1 100644
--- a/mod/workshop/tests/dates_test.php
+++ b/mod/workshop/tests/dates_test.php
@@ -43,7 +43,7 @@ class dates_test extends advanced_testcase {
* Data provider for get_dates_for_module().
* @return array[]
*/
- public function get_dates_for_module_provider(): array {
+ public static function get_dates_for_module_provider(): array {
$now = time();
$before = $now - DAYSECS;
$earlier = $before - DAYSECS;
diff --git a/mod/workshop/tests/lib_test.php b/mod/workshop/tests/lib_test.php
index cba6b2a8036..014c4767006 100644
--- a/mod/workshop/tests/lib_test.php
+++ b/mod/workshop/tests/lib_test.php
@@ -537,7 +537,7 @@ class lib_test extends \advanced_testcase {
*
* @return array of (submissionstart, submissionend, assessmentstart, assessmentend, eventtype, expectedmin, expectedmax)
*/
- public function mod_workshop_core_calendar_get_valid_event_timestart_range_due_no_limit_provider() {
+ public static function mod_workshop_core_calendar_get_valid_event_timestart_range_due_no_limit_provider(): array {
$submissionstart = time() + DAYSECS;
$submissionend = $submissionstart + DAYSECS;
$assessmentstart = $submissionend + DAYSECS;
@@ -692,7 +692,7 @@ class lib_test extends \advanced_testcase {
*
* @return array of (submissionstart, submissionend, assessmentstart, assessmentend, eventtype, fieldtoupdate, newtime)
*/
- public function mod_workshop_core_calendar_event_timestart_updated_provider() {
+ public static function mod_workshop_core_calendar_event_timestart_updated_provider(): array {
$submissionstart = time() + DAYSECS;
$submissionend = $submissionstart + DAYSECS;
$assessmentstart = $submissionend + DAYSECS;
diff --git a/notes/tests/reportbuilder/datasource/notes_test.php b/notes/tests/reportbuilder/datasource/notes_test.php
index 8c64498d90b..b2e0d363fb8 100644
--- a/notes/tests/reportbuilder/datasource/notes_test.php
+++ b/notes/tests/reportbuilder/datasource/notes_test.php
@@ -137,7 +137,7 @@ class notes_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
- public function datasource_filters_provider(): array {
+ public static function datasource_filters_provider(): array {
return [
'Filter content' => ['content', 'Cool', 'note:content', [
'note:content_operator' => text::IS_EQUAL_TO,
diff --git a/payment/tests/helper_test.php b/payment/tests/helper_test.php
index 184898e18eb..c68c9cd730d 100644
--- a/payment/tests/helper_test.php
+++ b/payment/tests/helper_test.php
@@ -137,7 +137,7 @@ class helper_test extends advanced_testcase {
*
* @return array
*/
- public function get_rounded_cost_provider(): array {
+ public static function get_rounded_cost_provider(): array {
return [
'IRR 0 surcharge' => [5.345, 'IRR', 0, 5],
'IRR 12% surcharge' => [5.345, 'IRR', 12, 6],
@@ -151,7 +151,7 @@ class helper_test extends advanced_testcase {
*
* @return array[]
*/
- public function get_cost_as_string_provider(): array {
+ public static function get_cost_as_string_provider(): array {
return [
'IRR 0 surcharge' => [5.345, 'IRR', 0, 'IRR'."\xc2\xa0".'5'],
'IRR 12% surcharge' => [5.345, 'IRR', 12, 'IRR'."\xc2\xa0".'6'],
diff --git a/privacy/tests/collection_test.php b/privacy/tests/collection_test.php
index d6b3e3cf699..9b10532e8ae 100644
--- a/privacy/tests/collection_test.php
+++ b/privacy/tests/collection_test.php
@@ -199,7 +199,7 @@ class collection_test extends \advanced_testcase {
*
* @return array
*/
- public function component_list_provider() {
+ public static function component_list_provider(): array {
return [
['core_privacy'],
['mod_forum'],
diff --git a/privacy/tests/contextlist_base_test.php b/privacy/tests/contextlist_base_test.php
index 5f979752040..6c9e5407a55 100644
--- a/privacy/tests/contextlist_base_test.php
+++ b/privacy/tests/contextlist_base_test.php
@@ -64,7 +64,7 @@ class contextlist_base_test extends advanced_testcase {
*
* @return array
*/
- public function get_contextids_provider() {
+ public static function get_contextids_provider(): array {
return [
'basic' => [
[1, 2, 3, 4, 5],
diff --git a/privacy/tests/contextlist_test.php b/privacy/tests/contextlist_test.php
index f2e44def162..098bcdada95 100644
--- a/privacy/tests/contextlist_test.php
+++ b/privacy/tests/contextlist_test.php
@@ -137,7 +137,7 @@ class contextlist_test extends advanced_testcase {
*
* @return array
*/
- public function data_guess_id_field_from_sql() {
+ public static function data_guess_id_field_from_sql(): array {
return [
'easy' => [
'SELECT contextid FROM {foo}',
diff --git a/privacy/tests/manager_test.php b/privacy/tests/manager_test.php
index cd65efa10b7..f2568280681 100644
--- a/privacy/tests/manager_test.php
+++ b/privacy/tests/manager_test.php
@@ -139,7 +139,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function component_is_compliant_provider() {
+ public static function component_is_compliant_provider(): array {
return [
'An empty subsystem' => [
'core_countries',
@@ -295,7 +295,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function is_empty_subsystem_provider() {
+ public static function is_empty_subsystem_provider(): array {
return [
'A subsystem which has no directory' => [
'core_langconfig',
diff --git a/privacy/tests/moodle_content_writer_test.php b/privacy/tests/moodle_content_writer_test.php
index 7b05e466e60..0f8aeea288c 100644
--- a/privacy/tests/moodle_content_writer_test.php
+++ b/privacy/tests/moodle_content_writer_test.php
@@ -173,7 +173,7 @@ class moodle_content_writer_test extends advanced_testcase {
/**
* Data provider for exporting user data.
*/
- public function export_data_provider() {
+ public static function export_data_provider(): array {
return [
'basic' => [
(object) [
@@ -308,7 +308,7 @@ class moodle_content_writer_test extends advanced_testcase {
*
* return array
*/
- public function export_metadata_provider() {
+ public static function export_metadata_provider(): array {
return [
'basic' => [
'key',
@@ -472,7 +472,7 @@ class moodle_content_writer_test extends advanced_testcase {
*
* @return array
*/
- public function export_file_provider() {
+ public static function export_file_provider(): array {
return [
'basic' => [
'intro',
@@ -858,7 +858,7 @@ class moodle_content_writer_test extends advanced_testcase {
*
* @return array
*/
- public function export_user_preference_provider() {
+ public static function export_user_preference_provider(): array {
return [
'basic' => [
'core_privacy',
@@ -1024,7 +1024,7 @@ class moodle_content_writer_test extends advanced_testcase {
*
* @return array
*/
- public function unescaped_unicode_export_provider() {
+ public static function unescaped_unicode_export_provider(): array {
return [
'Unicode' => ['ةكءيٓپچژکگیٹڈڑہھےâîûğŞAaÇÖáǽ你好!'],
];
@@ -1193,7 +1193,7 @@ class moodle_content_writer_test extends advanced_testcase {
*
* @return array
*/
- public function long_filename_provider() {
+ public static function long_filename_provider(): array {
return [
'More than 100 characters' => [
'Etiam sit amet dui vel leo blandit viverra. Proin viverra suscipit velit. Aenean efficitur suscipit nibh nec suscipit',
@@ -1288,7 +1288,7 @@ class moodle_content_writer_test extends advanced_testcase {
*
* @return array
*/
- public function rewrite_pluginfile_urls_provider() {
+ public static function rewrite_pluginfile_urls_provider(): array {
return [
'nullcontent' => [
'intro',
diff --git a/privacy/tests/privacy/provider_test.php b/privacy/tests/privacy/provider_test.php
index 178315dec1c..087f9e4ee35 100644
--- a/privacy/tests/privacy/provider_test.php
+++ b/privacy/tests/privacy/provider_test.php
@@ -46,7 +46,7 @@ class provider_test extends \advanced_testcase {
*
* @return array the array of frankenstyle component names with the relevant class name.
*/
- public function get_component_list() {
+ public static function get_component_list(): array {
$components = ['core' => [
'component' => 'core',
'classname' => manager::get_provider_classname_for_component('core')
@@ -97,12 +97,12 @@ class provider_test extends \advanced_testcase {
*
* @return array
*/
- public function null_provider_provider() {
- return array_filter($this->get_component_list(), function($component) {
- return static::component_implements(
- $component['classname'],
- \core_privacy\local\metadata\null_provider::class
- );
+ public static function null_provider_provider(): array {
+ return array_filter(self::get_component_list(), function($component): bool {
+ return static::component_implements(
+ $component['classname'],
+ \core_privacy\local\metadata\null_provider::class
+ );
});
}
@@ -218,12 +218,12 @@ class provider_test extends \advanced_testcase {
*
* @return array
*/
- public function metadata_provider_provider() {
- return array_filter($this->get_component_list(), function($component) {
- return static::component_implements(
- $component['classname'],
- \core_privacy\local\metadata\provider::class
- );
+ public static function metadata_provider_provider(): array {
+ return array_filter(self::get_component_list(), function($component): bool {
+ return static::component_implements(
+ $component['classname'],
+ \core_privacy\local\metadata\provider::class
+ );
});
}
@@ -232,12 +232,12 @@ class provider_test extends \advanced_testcase {
*
* @return array
*/
- public function is_user_data_provider() {
- return array_filter($this->get_component_list(), function($component) {
- return static::component_implements(
- $component['classname'],
- \core_privacy\local\request\core_user_data_provider::class
- );
+ public static function is_user_data_provider(): array {
+ return array_filter(self::get_component_list(), function($component): bool {
+ return static::component_implements(
+ $component['classname'],
+ \core_privacy\local\request\core_user_data_provider::class
+ );
});
}
@@ -310,7 +310,7 @@ class provider_test extends \advanced_testcase {
}
}
- $componentlist = $this->metadata_provider_provider();
+ $componentlist = self::metadata_provider_provider();
foreach ($componentlist as $componentarray) {
$component = $componentarray['component'];
$classname = $componentarray['classname'];
diff --git a/privacy/tests/request_transform_test.php b/privacy/tests/request_transform_test.php
index cb015ba882b..bb8b97b08a6 100644
--- a/privacy/tests/request_transform_test.php
+++ b/privacy/tests/request_transform_test.php
@@ -110,7 +110,7 @@ class request_transform_test extends advanced_testcase {
*
* @return array
*/
- public function yesno_provider() {
+ public static function yesno_provider(): array {
return [
'Bool False' => [
false,
diff --git a/privacy/tests/types_database_table_test.php b/privacy/tests/types_database_table_test.php
index 8472d0bb3df..fe0aee5aabc 100644
--- a/privacy/tests/types_database_table_test.php
+++ b/privacy/tests/types_database_table_test.php
@@ -84,7 +84,7 @@ class types_database_table_test extends \advanced_testcase {
*
* @return array
*/
- public function invalid_string_provider() {
+ public static function invalid_string_provider(): array {
return [
'Space in summary' => [
'example',
@@ -128,7 +128,7 @@ class types_database_table_test extends \advanced_testcase {
*
* @return array
*/
- public function valid_string_provider() {
+ public static function valid_string_provider(): array {
return [
'Valid combination' => [
'example',
diff --git a/privacy/tests/types_external_location_test.php b/privacy/tests/types_external_location_test.php
index 8f3c835527b..ceb6a3c6639 100644
--- a/privacy/tests/types_external_location_test.php
+++ b/privacy/tests/types_external_location_test.php
@@ -84,7 +84,7 @@ class types_external_location_test extends \advanced_testcase {
*
* @return array
*/
- public function invalid_string_provider() {
+ public static function invalid_string_provider(): array {
return [
'Space in summary' => [
'example',
@@ -128,7 +128,7 @@ class types_external_location_test extends \advanced_testcase {
*
* @return array
*/
- public function valid_string_provider() {
+ public static function valid_string_provider(): array {
return [
'Valid combination' => [
'example',
diff --git a/privacy/tests/types_plugintype_link_test.php b/privacy/tests/types_plugintype_link_test.php
index 9a0085a992b..51fea8c0ee2 100644
--- a/privacy/tests/types_plugintype_link_test.php
+++ b/privacy/tests/types_plugintype_link_test.php
@@ -77,7 +77,7 @@ class types_plugintype_link_test extends \advanced_testcase {
*
* @return array
*/
- public function invalid_string_provider() {
+ public static function invalid_string_provider(): array {
return [
'Space in summary' => [
'example',
@@ -97,7 +97,7 @@ class types_plugintype_link_test extends \advanced_testcase {
*
* @return array
*/
- public function valid_string_provider() {
+ public static function valid_string_provider(): array {
return [
'Valid combination' => [
'example',
diff --git a/privacy/tests/types_subsystem_link_test.php b/privacy/tests/types_subsystem_link_test.php
index 0459ddbb2bb..8c5ae16a5d9 100644
--- a/privacy/tests/types_subsystem_link_test.php
+++ b/privacy/tests/types_subsystem_link_test.php
@@ -77,7 +77,7 @@ class types_subsystem_link_test extends \advanced_testcase {
*
* @return array
*/
- public function invalid_string_provider() {
+ public static function invalid_string_provider(): array {
return [
'Space in summary' => [
'example',
@@ -97,7 +97,7 @@ class types_subsystem_link_test extends \advanced_testcase {
*
* @return array
*/
- public function valid_string_provider() {
+ public static function valid_string_provider(): array {
return [
'Valid combination' => [
'example',
diff --git a/privacy/tests/types_user_preference_test.php b/privacy/tests/types_user_preference_test.php
index b1b64a53552..cffd1024e1d 100644
--- a/privacy/tests/types_user_preference_test.php
+++ b/privacy/tests/types_user_preference_test.php
@@ -77,7 +77,7 @@ class types_user_preference_test extends \advanced_testcase {
*
* @return array
*/
- public function invalid_string_provider() {
+ public static function invalid_string_provider(): array {
return [
'Space in summary' => [
'example',
@@ -95,7 +95,7 @@ class types_user_preference_test extends \advanced_testcase {
*
* @return array
*/
- public function valid_string_provider() {
+ public static function valid_string_provider(): array {
return [
'Valid combination' => [
'example',
diff --git a/privacy/tests/userlist_base_test.php b/privacy/tests/userlist_base_test.php
index f6ec06edcf7..7ebdf246ab6 100644
--- a/privacy/tests/userlist_base_test.php
+++ b/privacy/tests/userlist_base_test.php
@@ -64,7 +64,7 @@ class userlist_base_test extends advanced_testcase {
*
* @return array
*/
- public function get_userids_provider() {
+ public static function get_userids_provider(): array {
return [
'basic' => [
[1, 2, 3, 4, 5],
diff --git a/question/bank/statistics/tests/helper_test.php b/question/bank/statistics/tests/helper_test.php
index e6ba911afe0..b6131885d57 100644
--- a/question/bank/statistics/tests/helper_test.php
+++ b/question/bank/statistics/tests/helper_test.php
@@ -200,7 +200,7 @@ class helper_test extends \advanced_testcase {
*
* @return array
*/
- private function generate_attempt_answers(array $correctanswerflags): array {
+ private static function generate_attempt_answers(array $correctanswerflags): array {
$attempt = [];
for ($i = 1; $i <= 4; $i++) {
if (isset($correctanswerflags) && $correctanswerflags[$i - 1] == 1) {
@@ -270,31 +270,31 @@ class helper_test extends \advanced_testcase {
*
* @return \Generator
*/
- public function load_question_facility_provider(): \Generator {
+ public static function load_question_facility_provider(): \Generator {
yield 'Facility case 1' => [
'Quiz 1 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
],
'Expected quiz 1 facilities' => ['100.00%', '0.00%', '0.00%', '0.00%'],
'Quiz 2 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
],
'Expected quiz 2 facilities' => ['100.00%', '50.00%', '0.00%', '0.00%'],
'Expected average facilities' => ['100.00%', '25.00%', '0.00%', '0.00%'],
];
yield 'Facility case 2' => [
'Quiz 1 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
- $this->generate_attempt_answers([1, 1, 1, 0]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 1, 1, 0]),
],
'Expected quiz 1 facilities' => ['100.00%', '66.67%', '33.33%', '0.00%'],
'Quiz 2 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
- $this->generate_attempt_answers([1, 1, 1, 0]),
- $this->generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 1, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
],
'Expected quiz 2 facilities' => ['100.00%', '75.00%', '50.00%', '25.00%'],
'Expected average facilities' => ['100.00%', '70.83%', '41.67%', '12.50%'],
@@ -378,20 +378,20 @@ class helper_test extends \advanced_testcase {
* Data provider for {@see test_load_question_discriminative_efficiency()}.
* @return \Generator
*/
- public function load_question_discriminative_efficiency_provider(): \Generator {
+ public static function load_question_discriminative_efficiency_provider(): \Generator {
yield 'Discriminative efficiency' => [
'Quiz 1 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
- $this->generate_attempt_answers([1, 0, 1, 0]),
- $this->generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 0, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
],
'Expected quiz 1 discriminative efficiency' => ['N/A', '33.33%', '33.33%', '100.00%'],
'Quiz 2 attempts' => [
- $this->generate_attempt_answers([1, 1, 1, 1]),
- $this->generate_attempt_answers([0, 0, 0, 0]),
- $this->generate_attempt_answers([1, 0, 0, 1]),
- $this->generate_attempt_answers([0, 1, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([0, 0, 0, 0]),
+ self::generate_attempt_answers([1, 0, 0, 1]),
+ self::generate_attempt_answers([0, 1, 1, 0]),
],
'Expected quiz 2 discriminative efficiency' => ['50.00%', '50.00%', '50.00%', '50.00%'],
'Expected average discriminative efficiency' => ['50.00%', '41.67%', '41.67%', '75.00%'],
@@ -499,20 +499,20 @@ class helper_test extends \advanced_testcase {
* Data provider for {@see test_load_question_discrimination_index()}.
* @return \Generator
*/
- public function load_question_discrimination_index_provider(): \Generator {
+ public static function load_question_discrimination_index_provider(): \Generator {
yield 'Discrimination Index' => [
'Quiz 1 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
- $this->generate_attempt_answers([1, 0, 1, 0]),
- $this->generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 0, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
],
'Expected quiz 1 Discrimination Index' => ['N/A', '30.15%', '30.15%', '81.65%'],
'Quiz 2 attempts' => [
- $this->generate_attempt_answers([1, 1, 1, 1]),
- $this->generate_attempt_answers([0, 0, 0, 0]),
- $this->generate_attempt_answers([1, 0, 0, 1]),
- $this->generate_attempt_answers([0, 1, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([0, 0, 0, 0]),
+ self::generate_attempt_answers([1, 0, 0, 1]),
+ self::generate_attempt_answers([0, 1, 1, 0]),
],
'Expected quiz 2 discrimination Index' => ['44.72%', '44.72%', '44.72%', '44.72%'],
'Expected average discrimination Index' => ['44.72%', '37.44%', '37.44%', '63.19%'],
diff --git a/question/bank/tagquestion/tests/external/submit_tags_test.php b/question/bank/tagquestion/tests/external/submit_tags_test.php
index 4113a06bc91..5aa088b97e5 100644
--- a/question/bank/tagquestion/tests/external/submit_tags_test.php
+++ b/question/bank/tagquestion/tests/external/submit_tags_test.php
@@ -202,7 +202,7 @@ class submit_tags_test extends \externallib_advanced_testcase {
*
* @return array Test cases
*/
- public function get_submit_tags_form_testcases() {
+ public static function get_submit_tags_form_testcases(): array {
return [
'course - course' => [
'editingcontext' => 'course',
@@ -284,7 +284,7 @@ class submit_tags_test extends \externallib_advanced_testcase {
* Course tags can only be set on a course category or system context question that
* is being editing in a course context.
*
- * @dataProvider get_submit_tags_form_testcases()
+ * @dataProvider get_submit_tags_form_testcases
* @param string $editingcontext The type of the context the question is being edited in
* @param string $questioncontext The type of the context the question belongs to
* @param string[] $questiontags The tag names to set as question tags
diff --git a/question/engine/tests/datalib_test.php b/question/engine/tests/datalib_test.php
index 6f85ce1c0e9..eed25ae429c 100644
--- a/question/engine/tests/datalib_test.php
+++ b/question/engine/tests/datalib_test.php
@@ -284,7 +284,7 @@ class datalib_test extends \qbehaviour_walkthrough_test_base {
*
* @return array test cases
*/
- public function get_file_area_name_cases(): array {
+ public static function get_file_area_name_cases(): array {
return [
'simple variable' => ['response_attachments', 'response_attachments'],
'behaviour variable' => ['response_5:answer', 'response_5answer'],
diff --git a/question/engine/tests/question_display_options_test.php b/question/engine/tests/question_display_options_test.php
index 1923c7bc27d..ece6c30f22a 100644
--- a/question/engine/tests/question_display_options_test.php
+++ b/question/engine/tests/question_display_options_test.php
@@ -32,7 +32,7 @@ class question_display_options_test extends \advanced_testcase {
*
* @return array[]
*/
- public function has_question_identifier_provider(): array {
+ public static function has_question_identifier_provider(): array {
return [
'Empty string' => ['', false],
'Empty space' => [' ', false],
@@ -61,7 +61,7 @@ class question_display_options_test extends \advanced_testcase {
*
* @return array[]
*/
- public function add_question_identifier_to_label_provider(): array {
+ public static function add_question_identifier_to_label_provider(): array {
return [
'Empty string identifier' => ['Hello', '', false, false, "Hello"],
'Null identifier' => ['Hello', null, false, false, "Hello"],
diff --git a/question/engine/tests/question_engine_test.php b/question/engine/tests/question_engine_test.php
index ca343edfc61..f1fd222421f 100644
--- a/question/engine/tests/question_engine_test.php
+++ b/question/engine/tests/question_engine_test.php
@@ -89,7 +89,7 @@ class question_engine_test extends advanced_testcase {
*
* @return array
*/
- public function get_behaviour_unused_display_options_provider(): array {
+ public static function get_behaviour_unused_display_options_provider(): array {
return [
'interactive' => [
'interactive',
@@ -127,7 +127,7 @@ class question_engine_test extends advanced_testcase {
*
* @return array
*/
- public function can_questions_finish_during_the_attempt_provider(): array {
+ public static function can_questions_finish_during_the_attempt_provider(): array {
return [
['deferredfeedback', false],
['interactive', true],
@@ -151,7 +151,7 @@ class question_engine_test extends advanced_testcase {
*
* @return array
*/
- public function sort_behaviours_provider(): array {
+ public static function sort_behaviours_provider(): array {
$in = [
'b1' => 'Behave 1',
'b2' => 'Behave 2',
@@ -222,7 +222,7 @@ class question_engine_test extends advanced_testcase {
*
* @return array
*/
- public function is_manual_grade_in_range_provider(): array {
+ public static function is_manual_grade_in_range_provider(): array {
return [
'In range' => [
'post' => [
@@ -309,7 +309,7 @@ class question_engine_test extends advanced_testcase {
*
* @return array
*/
- public function render_question_number_provider(): array {
+ public static function render_question_number_provider(): array {
return [
'Test with number is i character' => [
'i',
diff --git a/question/engine/tests/questionattempt_with_steps_test.php b/question/engine/tests/questionattempt_with_steps_test.php
index 7a10d6c2bd3..3c7583a702d 100644
--- a/question/engine/tests/questionattempt_with_steps_test.php
+++ b/question/engine/tests/questionattempt_with_steps_test.php
@@ -171,7 +171,7 @@ class questionattempt_with_steps_test extends \advanced_testcase {
*
* @return array test cases
*/
- public function validate_manual_mark_cases(): array {
+ public static function validate_manual_mark_cases(): array {
// Recall, the DB schema stores question grade information to 7 decimal places.
return [
[0, 1, 2, null, ''],
diff --git a/question/format/gift/tests/giftformat_test.php b/question/format/gift/tests/giftformat_test.php
index 9c49b2e08df..690a990ec56 100644
--- a/question/format/gift/tests/giftformat_test.php
+++ b/question/format/gift/tests/giftformat_test.php
@@ -369,7 +369,7 @@ class giftformat_test extends \question_testcase {
*
* @return array Array of 1-element arrays of qtype_multichoice numbering styles
*/
- public function numberingstyle_provider() {
+ public static function numberingstyle_provider(): array {
return [
['abc'],
['ABCD'],
@@ -1333,7 +1333,7 @@ FALSE#42 is the Ultimate Answer.#You gave the right answer.}";
*
* @return array the test cases.
*/
- public function extract_idnumber_and_tags_from_comment_testcases() {
+ public static function extract_idnumber_and_tags_from_comment_testcases(): array {
return [
'blank comment' => ['', [], ''],
'nothing in comment' => ['', [], '// A basic comment.'],
diff --git a/question/tests/calculated_question_summary_test.php b/question/tests/calculated_question_summary_test.php
index 00885c0cfbe..f62be2eb3aa 100644
--- a/question/tests/calculated_question_summary_test.php
+++ b/question/tests/calculated_question_summary_test.php
@@ -33,7 +33,7 @@ class calculated_question_summary_test extends \advanced_testcase {
*
* @return array
*/
- public function get_min_max_provider() {
+ public static function get_min_max_provider(): array {
return [
'negative number and null' => [
[
@@ -105,7 +105,7 @@ class calculated_question_summary_test extends \advanced_testcase {
*
* @return array
*/
- public function get_sd_min_max_provider() {
+ public static function get_sd_min_max_provider(): array {
return [
'null and number' => [
[
diff --git a/question/tests/externallib_test.php b/question/tests/externallib_test.php
index cf74e76664b..5f3cb4aae07 100644
--- a/question/tests/externallib_test.php
+++ b/question/tests/externallib_test.php
@@ -113,7 +113,7 @@ class externallib_test extends externallib_advanced_testcase {
/**
* Data provider for the get_random_question_summaries test.
*/
- public function get_random_question_summaries_test_cases() {
+ public static function get_random_question_summaries_test_cases(): array {
return [
'empty category' => [
'categoryindex' => 'emptycat',
@@ -185,7 +185,7 @@ class externallib_test extends externallib_advanced_testcase {
* Parent: cat1
* Category: emptycat
*
- * @dataProvider get_random_question_summaries_test_cases()
+ * @dataProvider get_random_question_summaries_test_cases
* @param string $categoryindex The named index for the category to use
* @param bool $includesubcategories If the search should include subcategories
* @param string[] $usetagnames The tag names to include in the search
diff --git a/question/tests/local/statistics/statistics_bulk_loader_test.php b/question/tests/local/statistics/statistics_bulk_loader_test.php
index 81d2477e55a..255cf9ead8d 100644
--- a/question/tests/local/statistics/statistics_bulk_loader_test.php
+++ b/question/tests/local/statistics/statistics_bulk_loader_test.php
@@ -222,7 +222,7 @@ class statistics_bulk_loader_test extends advanced_testcase {
*
* @return array
*/
- private function generate_attempt_answers(array $correctanswerflags): array {
+ private static function generate_attempt_answers(array $correctanswerflags): array {
$attempt = [];
for ($i = 1; $i <= 4; $i++) {
if (isset($correctanswerflags) && $correctanswerflags[$i - 1] == 1) {
@@ -291,31 +291,31 @@ class statistics_bulk_loader_test extends advanced_testcase {
*
* @return Generator
*/
- public function load_question_facility_provider(): Generator {
+ public static function load_question_facility_provider(): Generator {
yield 'Facility case 1' => [
'Quiz 1 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
],
'Expected quiz 1 facilities' => [1.0, 0.0, 0.0, 0.0],
'Quiz 2 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
],
'Expected quiz 2 facilities' => [1.0, 0.5, 0.0, 0.0],
'Expected average facilities' => [1.0, 0.25, 0.0, 0.0],
];
yield 'Facility case 2' => [
'Quiz 1 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
- $this->generate_attempt_answers([1, 1, 1, 0]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 1, 1, 0]),
],
'Expected quiz 1 facilities' => [1.0, 0.6667, 0.3333, 0.0],
'Quiz 2 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
- $this->generate_attempt_answers([1, 1, 1, 0]),
- $this->generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 1, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
],
'Expected quiz 2 facilities' => [1.0, 0.75, 0.5, 0.25],
'Expected average facilities' => [1.0, 0.7083, 0.4167, 0.1250],
@@ -388,20 +388,20 @@ class statistics_bulk_loader_test extends advanced_testcase {
* Data provider for {@see test_load_question_discriminative_efficiency()}.
* @return Generator
*/
- public function load_question_discriminative_efficiency_provider(): Generator {
+ public static function load_question_discriminative_efficiency_provider(): Generator {
yield 'Discriminative efficiency' => [
'Quiz 1 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
- $this->generate_attempt_answers([1, 0, 1, 0]),
- $this->generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 0, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
],
'Expected quiz 1 discriminative efficiency' => [null, 33.33, 33.33, 100.00],
'Quiz 2 attempts' => [
- $this->generate_attempt_answers([1, 1, 1, 1]),
- $this->generate_attempt_answers([0, 0, 0, 0]),
- $this->generate_attempt_answers([1, 0, 0, 1]),
- $this->generate_attempt_answers([0, 1, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([0, 0, 0, 0]),
+ self::generate_attempt_answers([1, 0, 0, 1]),
+ self::generate_attempt_answers([0, 1, 1, 0]),
],
'Expected quiz 2 discriminative efficiency' => [50.00, 50.00, 50.00, 50.00],
'Expected average discriminative efficiency' => [50.00, 41.67, 41.67, 75.00],
@@ -482,20 +482,20 @@ class statistics_bulk_loader_test extends advanced_testcase {
* Data provider for {@see test_load_question_discrimination_index()}.
* @return Generator
*/
- public function load_question_discrimination_index_provider(): Generator {
+ public static function load_question_discrimination_index_provider(): Generator {
yield 'Discrimination Index' => [
'Quiz 1 attempts' => [
- $this->generate_attempt_answers([1, 0, 0, 0]),
- $this->generate_attempt_answers([1, 1, 0, 0]),
- $this->generate_attempt_answers([1, 0, 1, 0]),
- $this->generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([1, 0, 0, 0]),
+ self::generate_attempt_answers([1, 1, 0, 0]),
+ self::generate_attempt_answers([1, 0, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
],
'Expected quiz 1 Discrimination Index' => [null, 30.15, 30.15, 81.65],
'Quiz 2 attempts' => [
- $this->generate_attempt_answers([1, 1, 1, 1]),
- $this->generate_attempt_answers([0, 0, 0, 0]),
- $this->generate_attempt_answers([1, 0, 0, 1]),
- $this->generate_attempt_answers([0, 1, 1, 0]),
+ self::generate_attempt_answers([1, 1, 1, 1]),
+ self::generate_attempt_answers([0, 0, 0, 0]),
+ self::generate_attempt_answers([1, 0, 0, 1]),
+ self::generate_attempt_answers([0, 1, 1, 0]),
],
'Expected quiz 2 discrimination Index' => [44.72, 44.72, 44.72, 44.72],
'Expected average discrimination Index' => [44.72, 37.44, 37.44, 63.19],
@@ -579,8 +579,8 @@ class statistics_bulk_loader_test extends advanced_testcase {
$this->resetAfterTest();
// Prepare some quizzes and attempts. Exactly what is not important to this test.
- $quiz1attempts = [$this->generate_attempt_answers([1, 0, 0, 0])];
- $quiz2attempts = [$this->generate_attempt_answers([1, 1, 1, 1])];
+ $quiz1attempts = [self::generate_attempt_answers([1, 0, 0, 0])];
+ $quiz2attempts = [self::generate_attempt_answers([1, 1, 1, 1])];
[, , $questions] = $this->prepare_and_submit_quizzes($quiz1attempts, $quiz2attempts);
// Prepare some useful arrays.
diff --git a/question/tests/random_question_loader_test.php b/question/tests/random_question_loader_test.php
index 33b05269690..c4775f7f2df 100644
--- a/question/tests/random_question_loader_test.php
+++ b/question/tests/random_question_loader_test.php
@@ -379,7 +379,7 @@ final class random_question_loader_test extends \advanced_testcase {
* Parent: cat1
* Category: emptycat
*
- * @dataProvider get_questions_test_cases()
+ * @dataProvider get_questions_test_cases
* @param string $categoryindex The named index for the category to use
* @param bool $includesubcategories If the search should include subcategories
* @param string[] $usetagnames The tag names to include in the search
@@ -589,7 +589,7 @@ final class random_question_loader_test extends \advanced_testcase {
* Parent: cat1
* Category: emptycat
*
- * @dataProvider count_questions_test_cases()
+ * @dataProvider count_questions_test_cases
* @param string $categoryindex The named index for the category to use
* @param bool $includesubcategories If the search should include subcategories
* @param string[] $usetagnames The tag names to include in the search
diff --git a/question/type/ddimageortext/tests/privacy/provider_test.php b/question/type/ddimageortext/tests/privacy/provider_test.php
index 15325d7e195..0d5f297f26a 100644
--- a/question/type/ddimageortext/tests/privacy/provider_test.php
+++ b/question/type/ddimageortext/tests/privacy/provider_test.php
@@ -91,7 +91,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return [
'default mark 1' => ['defaultmark', 1, 1],
'penalty 33.33333%' => ['penalty', 0.3333333, '33.33333%'],
diff --git a/question/type/ddmarker/tests/privacy/provider_test.php b/question/type/ddmarker/tests/privacy/provider_test.php
index 32af89f80ca..fb48153e653 100644
--- a/question/type/ddmarker/tests/privacy/provider_test.php
+++ b/question/type/ddmarker/tests/privacy/provider_test.php
@@ -91,7 +91,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return [
'default mark 1.5' => ['defaultmark', 1.5, 1.5],
'penalty 33.33333%' => ['penalty', 0.3333333, '33.33333%'],
diff --git a/question/type/ddwtos/tests/privacy/provider_test.php b/question/type/ddwtos/tests/privacy/provider_test.php
index 16f785d7e7b..481b2cda10e 100644
--- a/question/type/ddwtos/tests/privacy/provider_test.php
+++ b/question/type/ddwtos/tests/privacy/provider_test.php
@@ -91,7 +91,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return [
'default mark 2' => ['defaultmark', 2, 2],
'penalty 33.33333%' => ['penalty', 0.3333333, '33.33333%'],
diff --git a/question/type/essay/tests/form/edit_form_test.php b/question/type/essay/tests/form/edit_form_test.php
index f2f6c7bed81..f55765a44e5 100644
--- a/question/type/essay/tests/form/edit_form_test.php
+++ b/question/type/essay/tests/form/edit_form_test.php
@@ -102,7 +102,7 @@ class edit_form_test extends \advanced_testcase {
*
* @return array, an array of all possible options.
*/
- public function user_preference_provider(): array {
+ public static function user_preference_provider(): array {
$valid = [];
$invalid = ['attachmentsrequired' => get_string('mustrequirefewer', 'qtype_essay')];
return [
diff --git a/question/type/essay/tests/privacy/provider_test.php b/question/type/essay/tests/privacy/provider_test.php
index 705bd39f297..a4eb87bee50 100644
--- a/question/type/essay/tests/privacy/provider_test.php
+++ b/question/type/essay/tests/privacy/provider_test.php
@@ -91,7 +91,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return [
'default mark 2' => ['defaultmark', 2, 2],
'responseformat editror ' => ['responseformat', 'editor', get_string('formateditor', 'qtype_essay')],
diff --git a/question/type/essay/tests/question_test.php b/question/type/essay/tests/question_test.php
index 24d3b4e7bf1..778afa39fc9 100644
--- a/question/type/essay/tests/question_test.php
+++ b/question/type/essay/tests/question_test.php
@@ -80,7 +80,7 @@ class question_test extends \advanced_testcase {
*
* @return array List of data sets (test cases)
*/
- public function summarise_response_provider(): array {
+ public static function summarise_response_provider(): array {
return [
'text input required, not attachments required' =>
[1, 0, 'This is the text input for this essay.', 0, 'This is the text input for this essay.'],
@@ -331,7 +331,7 @@ class question_test extends \advanced_testcase {
*
* (The tests are done with a fixed 14-word response.)
*
- * @dataProvider get_min_max_wordlimit_test_cases()
+ * @dataProvider get_min_max_wordlimit_test_cases
* @param int $responserequired whether response required (yes = 1, no = 0)
* @param int $minwordlimit minimum word limit
* @param int $maxwordlimit maximum word limit
@@ -353,7 +353,7 @@ class question_test extends \advanced_testcase {
*
* @return array the test cases.
*/
- public function get_min_max_wordlimit_test_cases(): array {
+ public static function get_min_max_wordlimit_test_cases(): array {
return [
'text input required, min/max word limit not set' => [1, 0, 0, ''],
'text input required, min/max word limit valid (within the boundaries)' => [1, 10, 25, ''],
@@ -370,7 +370,7 @@ class question_test extends \advanced_testcase {
*
* (The tests are done with a fixed 14-word response.)
*
- * @dataProvider get_word_count_message_for_review_test_cases()
+ * @dataProvider get_word_count_message_for_review_test_cases
* @param int|null $minwordlimit minimum word limit
* @param int|null $maxwordlimit maximum word limit
* @param string $expected error message | null
@@ -389,7 +389,7 @@ class question_test extends \advanced_testcase {
*
* @return array the test cases.
*/
- public function get_word_count_message_for_review_test_cases() {
+ public static function get_word_count_message_for_review_test_cases(): array {
return [
'No limit' =>
[null, null, ''],
diff --git a/question/type/gapselect/tests/privacy/provider_test.php b/question/type/gapselect/tests/privacy/provider_test.php
index bec3ff4ac76..e19ca06ce62 100644
--- a/question/type/gapselect/tests/privacy/provider_test.php
+++ b/question/type/gapselect/tests/privacy/provider_test.php
@@ -91,7 +91,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return [
'default mark 1.5' => ['defaultmark', 1.5, 1.5],
'penalty 25%' => ['penalty', 0.2500000, '25%'],
diff --git a/question/type/match/tests/privacy/provider_test.php b/question/type/match/tests/privacy/provider_test.php
index cea8fc9647b..0717e8765ae 100644
--- a/question/type/match/tests/privacy/provider_test.php
+++ b/question/type/match/tests/privacy/provider_test.php
@@ -91,7 +91,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return [
'default mark 1' => ['defaultmark', 1, 1],
'penalty 33.33333%' => ['penalty', 0.3333333, '33.33333%'],
diff --git a/question/type/multichoice/tests/privacy/provider_test.php b/question/type/multichoice/tests/privacy/provider_test.php
index b450090aa36..d2b6592ab93 100644
--- a/question/type/multichoice/tests/privacy/provider_test.php
+++ b/question/type/multichoice/tests/privacy/provider_test.php
@@ -91,7 +91,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return [
'default mark 2' => ['defaultmark', 2, 2],
'penalty 33.33333%' => ['penalty', 0.3333333, '33.33333%'],
diff --git a/question/type/multichoice/tests/question_type_test.php b/question/type/multichoice/tests/question_type_test.php
index 5e319bbb680..32b1a0cec72 100644
--- a/question/type/multichoice/tests/question_type_test.php
+++ b/question/type/multichoice/tests/question_type_test.php
@@ -109,7 +109,7 @@ class question_type_test extends \advanced_testcase {
), $this->qtype->get_possible_responses($q));
}
- public function get_question_saving_which() {
+ public static function get_question_saving_which(): array {
return array(array('two_of_four'), array('one_of_four'));
}
diff --git a/question/type/numerical/tests/answerprocessor_test.php b/question/type/numerical/tests/answerprocessor_test.php
index eb2271331f1..fe70e96a24d 100644
--- a/question/type/numerical/tests/answerprocessor_test.php
+++ b/question/type/numerical/tests/answerprocessor_test.php
@@ -72,7 +72,7 @@ class answerprocessor_test extends \advanced_testcase {
*
* @return array
*/
- public function parse_response_provider(): array {
+ public static function parse_response_provider(): array {
return [
[['3', '142', '', ''], '3.142'],
[['', '2', '', ''], '.2'],
@@ -191,7 +191,7 @@ class answerprocessor_test extends \advanced_testcase {
*
* @return array
*/
- public function apply_units_provider(): array {
+ public static function apply_units_provider(): array {
return [
[3e8, 'm/s', 1, '3x10^8 m/s'],
[3e8, '', null, '3x10^8'],
@@ -250,7 +250,7 @@ class answerprocessor_test extends \advanced_testcase {
*
* @return array
*/
- public function apply_units_provider_with_units(): array {
+ public static function apply_units_provider_with_units(): array {
return [
[3e8, 'm/s', 1, '3x10^8', 'm/s'],
[3e8, '', null, '3x10^8', ''],
@@ -280,7 +280,7 @@ class answerprocessor_test extends \advanced_testcase {
*
* return array
*/
- public function euro_provider(): array {
+ public static function euro_provider(): array {
return [
[[-1000, '', null], '-1 000'],
[[3.14159, '', null], '3,14159'],
@@ -305,7 +305,7 @@ class answerprocessor_test extends \advanced_testcase {
*
* @return array
*/
- public function percent_provider(): array {
+ public static function percent_provider(): array {
return [
[['3', '%', 0.01], '3%'],
[['1e-6', '%', 0.01], '1e-6 %'],
@@ -334,7 +334,7 @@ class answerprocessor_test extends \advanced_testcase {
*
* @return array
*/
- public function currency_provider(): array {
+ public static function currency_provider(): array {
return [
[['1234.56', '£', 1], '£1,234.56'],
[['100', '$', 1], '$100'],
diff --git a/question/type/shortanswer/tests/privacy/provider_test.php b/question/type/shortanswer/tests/privacy/provider_test.php
index 894e16f90a5..349de02c4cd 100644
--- a/question/type/shortanswer/tests/privacy/provider_test.php
+++ b/question/type/shortanswer/tests/privacy/provider_test.php
@@ -91,7 +91,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array Array of valid user preferences.
*/
- public function user_preference_provider() {
+ public static function user_preference_provider(): array {
return [
'default mark 2' => ['defaultmark', 2, 2],
'penalty 33.33333%' => ['penalty', 0.3333333, '33.33333%'],
diff --git a/rating/tests/rating_test.php b/rating/tests/rating_test.php
index 1b80720aa16..a6cb028eb2a 100644
--- a/rating/tests/rating_test.php
+++ b/rating/tests/rating_test.php
@@ -279,7 +279,7 @@ class rating_test extends \advanced_testcase {
*
* @return array
*/
- public function get_aggregate_string_provider() {
+ public static function get_aggregate_string_provider(): array {
return [
'Non-numeric aggregate produces empty string' => [
RATING_AGGREGATE_NONE,
diff --git a/reportbuilder/tests/external/system_report_exporter_test.php b/reportbuilder/tests/external/system_report_exporter_test.php
index 4d73c920304..0bd991d10f2 100644
--- a/reportbuilder/tests/external/system_report_exporter_test.php
+++ b/reportbuilder/tests/external/system_report_exporter_test.php
@@ -49,7 +49,7 @@ class system_report_exporter_test extends advanced_testcase {
*
* @return array[]
*/
- public function export_provider(): array {
+ public static function export_provider(): array {
return [
['With filters' => true],
['Without filters' => false],
diff --git a/reportbuilder/tests/local/entities/user_test.php b/reportbuilder/tests/local/entities/user_test.php
index f45be4efd72..a227bcd36b2 100644
--- a/reportbuilder/tests/local/entities/user_test.php
+++ b/reportbuilder/tests/local/entities/user_test.php
@@ -130,7 +130,7 @@ class user_test extends advanced_testcase {
*
* @return array
*/
- public function get_name_fields_select_provider(): array {
+ public static function get_name_fields_select_provider(): array {
return [
['firstname', ['firstname']],
['firstname lastname', ['firstname', 'lastname']],
diff --git a/reportbuilder/tests/local/filters/autocomplete_test.php b/reportbuilder/tests/local/filters/autocomplete_test.php
index e42768eb18f..5216cccc7c4 100644
--- a/reportbuilder/tests/local/filters/autocomplete_test.php
+++ b/reportbuilder/tests/local/filters/autocomplete_test.php
@@ -37,7 +37,7 @@ class autocomplete_test extends advanced_testcase {
*
* @return array
*/
- public function get_sql_filter_provider(): array {
+ public static function get_sql_filter_provider(): array {
return [
[[], ["Course 1 full name", "Course 2 full name", "Course 3 full name", "PHPUnit test site"]],
[["course1", "course3"], ["Course 1 full name", "Course 3 full name"]],
diff --git a/reportbuilder/tests/local/filters/boolean_select_test.php b/reportbuilder/tests/local/filters/boolean_select_test.php
index ee28dfedc86..f808e66c326 100644
--- a/reportbuilder/tests/local/filters/boolean_select_test.php
+++ b/reportbuilder/tests/local/filters/boolean_select_test.php
@@ -38,7 +38,7 @@ class boolean_select_test extends advanced_testcase {
*
* @return array
*/
- public function get_sql_filter_simple_provider(): array {
+ public static function get_sql_filter_simple_provider(): array {
return [
[boolean_select::ANY_VALUE, true],
[boolean_select::CHECKED, true],
diff --git a/reportbuilder/tests/local/filters/category_test.php b/reportbuilder/tests/local/filters/category_test.php
index 5b57b5edfa1..2a898317940 100644
--- a/reportbuilder/tests/local/filters/category_test.php
+++ b/reportbuilder/tests/local/filters/category_test.php
@@ -38,7 +38,7 @@ class category_test extends advanced_testcase {
*
* @return array
*/
- public function get_sql_filter_provider(): array {
+ public static function get_sql_filter_provider(): array {
return [
// Equal to.
['One', category::EQUAL_TO, false, ['One']],
diff --git a/reportbuilder/tests/local/filters/select_test.php b/reportbuilder/tests/local/filters/select_test.php
index 2038a7bbc9f..475ae6b5851 100644
--- a/reportbuilder/tests/local/filters/select_test.php
+++ b/reportbuilder/tests/local/filters/select_test.php
@@ -38,7 +38,7 @@ class select_test extends advanced_testcase {
*
* @return array
*/
- public function get_sql_filter_simple_provider(): array {
+ public static function get_sql_filter_simple_provider(): array {
return [
[select::ANY_VALUE, null, true],
[select::EQUAL_TO, 'starwars', true],
diff --git a/reportbuilder/tests/local/filters/text_test.php b/reportbuilder/tests/local/filters/text_test.php
index 6bce83f6322..e5aaa01d5e8 100644
--- a/reportbuilder/tests/local/filters/text_test.php
+++ b/reportbuilder/tests/local/filters/text_test.php
@@ -38,7 +38,7 @@ class text_test extends advanced_testcase {
*
* @return array
*/
- public function get_sql_filter_simple_provider(): array {
+ public static function get_sql_filter_simple_provider(): array {
return [
[text::ANY_VALUE, null, true],
[text::CONTAINS, 'looking', true],
@@ -107,7 +107,7 @@ class text_test extends advanced_testcase {
*
* @return array
*/
- public function get_sql_filter_empty_provider(): array {
+ public static function get_sql_filter_empty_provider(): array {
return [
[text::IS_EMPTY, null, true],
[text::IS_EMPTY, '', true],
diff --git a/reportbuilder/tests/local/filters/user_test.php b/reportbuilder/tests/local/filters/user_test.php
index a9cc75590bf..ea041c402e9 100644
--- a/reportbuilder/tests/local/filters/user_test.php
+++ b/reportbuilder/tests/local/filters/user_test.php
@@ -38,7 +38,7 @@ class user_test extends advanced_testcase {
*
* @return array
*/
- public function get_sql_filter_simple(): array {
+ public static function get_sql_filter_simple(): array {
return [
[user::USER_ANY, ['admin', 'guest', 'user01', 'user02']],
[user::USER_CURRENT, ['user01']],
diff --git a/reportbuilder/tests/local/helpers/schedule_test.php b/reportbuilder/tests/local/helpers/schedule_test.php
index 266490f29ec..21bafb08413 100644
--- a/reportbuilder/tests/local/helpers/schedule_test.php
+++ b/reportbuilder/tests/local/helpers/schedule_test.php
@@ -271,7 +271,7 @@ final class schedule_test extends advanced_testcase {
*
* @return string[]
*/
- public function get_schedule_report_file_format(): array {
+ public static function get_schedule_report_file_format(): array {
return [
['csv'],
['excel'],
diff --git a/reportbuilder/tests/local/helpers/user_filter_manager_test.php b/reportbuilder/tests/local/helpers/user_filter_manager_test.php
index c3049ba757d..909c3667877 100644
--- a/reportbuilder/tests/local/helpers/user_filter_manager_test.php
+++ b/reportbuilder/tests/local/helpers/user_filter_manager_test.php
@@ -46,7 +46,7 @@ class user_filter_manager_test extends advanced_testcase {
*
* @return array
*/
- public function get_provider(): array {
+ public static function get_provider(): array {
return [
'Small value' => ['foo'],
'Large value' => [str_repeat('A', 4000)],
@@ -113,7 +113,7 @@ class user_filter_manager_test extends advanced_testcase {
*
* @return array
*/
- public function reset_all_provider(): array {
+ public static function reset_all_provider(): array {
return [
'Small value' => ['foo'],
'Large value' => [str_repeat('A', 4000)],
diff --git a/reportbuilder/tests/local/report/action_test.php b/reportbuilder/tests/local/report/action_test.php
index 316a3f114e7..1e3735c96ea 100644
--- a/reportbuilder/tests/local/report/action_test.php
+++ b/reportbuilder/tests/local/report/action_test.php
@@ -63,7 +63,7 @@ class action_test extends advanced_testcase {
*
* @return array[]
*/
- public function action_title_provider(): array {
+ public static function action_title_provider(): array {
$title = new lang_string('yes');
return [
'Specified via constructor' => ['', [], $title],
diff --git a/reportbuilder/tests/manager_test.php b/reportbuilder/tests/manager_test.php
index 2d1b313f563..f2ebc6bafe6 100644
--- a/reportbuilder/tests/manager_test.php
+++ b/reportbuilder/tests/manager_test.php
@@ -181,7 +181,7 @@ class manager_test extends core_reportbuilder_testcase {
*
* @return array
*/
- public function report_limit_reached_provider(): array {
+ public static function report_limit_reached_provider(): array {
return [
[0, 1, false],
[1, 1, true],
diff --git a/reportbuilder/tests/task/send_schedule_test.php b/reportbuilder/tests/task/send_schedule_test.php
index 57958a1ce09..9e63827a7d3 100644
--- a/reportbuilder/tests/task/send_schedule_test.php
+++ b/reportbuilder/tests/task/send_schedule_test.php
@@ -44,7 +44,7 @@ class send_schedule_test extends advanced_testcase {
*
* @return array[]
*/
- public function execute_report_viewas_user_provider(): array {
+ public static function execute_report_viewas_user_provider(): array {
return [
'View report as schedule creator' => [schedule::REPORT_VIEWAS_CREATOR, null, 'admin', 'admin'],
'View report as schedule recipient' => [schedule::REPORT_VIEWAS_RECIPIENT, null, 'userone', 'usertwo'],
diff --git a/repository/contentbank/tests/search/search_test.php b/repository/contentbank/tests/search/search_test.php
index d2896bc2b15..0c21e1c1b57 100644
--- a/repository/contentbank/tests/search/search_test.php
+++ b/repository/contentbank/tests/search/search_test.php
@@ -75,7 +75,7 @@ class search_test extends \advanced_testcase {
*
* @return array
*/
- public function get_search_contents_provider(): array {
+ public static function get_search_contents_provider(): array {
return [
'Search for existing pattern found within the name of content items' => [
[
diff --git a/repository/dropbox/tests/api_test.php b/repository/dropbox/tests/api_test.php
index 383ef508d05..b4031a9fd9a 100644
--- a/repository/dropbox/tests/api_test.php
+++ b/repository/dropbox/tests/api_test.php
@@ -29,7 +29,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function has_additional_results_provider() {
+ public static function has_additional_results_provider(): array {
return [
'No more results' => [
(object) [
@@ -88,7 +88,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function check_and_handle_api_errors_provider() {
+ public static function check_and_handle_api_errors_provider(): array {
return [
'200 http_code' => [
['http_code' => 200],
@@ -179,7 +179,7 @@ class api_test extends \advanced_testcase {
*
* @return array
*/
- public function supports_thumbnail_provider() {
+ public static function supports_thumbnail_provider(): array {
$tests = [
'Only files support thumbnails' => [
(object) ['.tag' => 'folder'],
diff --git a/repository/googledocs/tests/googledocs_search_content_test.php b/repository/googledocs/tests/googledocs_search_content_test.php
index 271f0a4b98e..30612363bd2 100644
--- a/repository/googledocs/tests/googledocs_search_content_test.php
+++ b/repository/googledocs/tests/googledocs_search_content_test.php
@@ -111,7 +111,7 @@ class googledocs_search_content_test extends \googledocs_content_testcase {
*
* @return array
*/
- public function get_content_nodes_provider(): array {
+ public static function get_content_nodes_provider(): array {
$rootid = \repository_googledocs::REPOSITORY_ROOT_ID;
$searchnodeid = \repository_googledocs::SEARCH_ROOT_ID;
@@ -124,26 +124,26 @@ class googledocs_search_content_test extends \googledocs_content_testcase {
true,
[],
[
- $this->create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
+ self::create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
],
[
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'Test file 3.pdf',
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'Test file 3.pdf',
'application/pdf', 'pdf', '1000', '',
'https://drive.google.com/uc?id=d85b21c0f86cb0&export=download'),
- $this->create_google_drive_folder_object('0c4ad262c65333', 'Test folder 1'),
- $this->create_google_drive_file_object('bed5a0f08d412a', 'Test file 1.pdf',
+ self::create_google_drive_folder_object('0c4ad262c65333', 'Test folder 1'),
+ self::create_google_drive_file_object('bed5a0f08d412a', 'Test file 1.pdf',
'application/pdf', 'pdf'),
- $this->create_google_drive_folder_object('9c4ad262c65333', 'Test folder 2'),
+ self::create_google_drive_folder_object('9c4ad262c65333', 'Test folder 2'),
],
[
- $this->create_folder_content_node_array('0c4ad262c65333', 'Test folder 1',
+ self::create_folder_content_node_array('0c4ad262c65333', 'Test folder 1',
"{$rootid}|Google+Drive/{$searchnodeid}|" . urlencode("{$searchforstring} 'test'")),
- $this->create_folder_content_node_array('9c4ad262c65333', 'Test folder 2',
+ self::create_folder_content_node_array('9c4ad262c65333', 'Test folder 2',
"{$rootid}|Google+Drive/{$searchnodeid}|" . urlencode("{$searchforstring} 'test'")),
- $this->create_file_content_node_array('bed5a0f08d412a', 'Test file 1.pdf',
+ self::create_file_content_node_array('bed5a0f08d412a', 'Test file 1.pdf',
'Test file 1.pdf', null, '', 'https://googleusercontent.com/type/application/pdf',
'', 'download'),
- $this->create_file_content_node_array('d85b21c0f86cb0', 'Test file 3.pdf',
+ self::create_file_content_node_array('d85b21c0f86cb0', 'Test file 3.pdf',
'Test file 3.pdf', '1000', '', 'https://googleusercontent.com/type/application/pdf',
'https://drive.google.com/uc?id=d85b21c0f86cb0&export=download', 'download'),
],
@@ -155,16 +155,16 @@ class googledocs_search_content_test extends \googledocs_content_testcase {
[],
[],
[
- $this->create_google_drive_folder_object('0c4ad262c65333', 'Testing folder 3'),
- $this->create_google_drive_folder_object('d85b21c0f86cb0', 'Testing folder 1'),
- $this->create_google_drive_folder_object('bed5a0f08d412a', 'Testing folder 2'),
+ self::create_google_drive_folder_object('0c4ad262c65333', 'Testing folder 3'),
+ self::create_google_drive_folder_object('d85b21c0f86cb0', 'Testing folder 1'),
+ self::create_google_drive_folder_object('bed5a0f08d412a', 'Testing folder 2'),
],
[
- $this->create_folder_content_node_array('0c4ad262c65333', 'Testing folder 3',
+ self::create_folder_content_node_array('0c4ad262c65333', 'Testing folder 3',
"{$rootid}|Google+Drive/{$searchnodeid}|" . urlencode("{$searchforstring} 'testing'")),
- $this->create_folder_content_node_array('d85b21c0f86cb0', 'Testing folder 1',
+ self::create_folder_content_node_array('d85b21c0f86cb0', 'Testing folder 1',
"{$rootid}|Google+Drive/{$searchnodeid}|" . urlencode("{$searchforstring} 'testing'")),
- $this->create_folder_content_node_array('bed5a0f08d412a', 'Testing folder 2',
+ self::create_folder_content_node_array('bed5a0f08d412a', 'Testing folder 2',
"{$rootid}|Google+Drive/{$searchnodeid}|" . urlencode("{$searchforstring} 'testing'")),
],
],
@@ -174,18 +174,18 @@ class googledocs_search_content_test extends \googledocs_content_testcase {
false,
['doc', 'txt'],
[
- $this->create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
+ self::create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
],
[
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'Testing file 3.pdf',
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'Testing file 3.pdf',
'application/pdf', 'pdf', '1000'),
- $this->create_google_drive_file_object('a85b21c0f86cb0', 'Testing file 1.txt',
+ self::create_google_drive_file_object('a85b21c0f86cb0', 'Testing file 1.txt',
'text/plain', 'txt', '3000'),
- $this->create_google_drive_file_object('f85b21c0f86cb0', 'Testing file 2.doc',
+ self::create_google_drive_file_object('f85b21c0f86cb0', 'Testing file 2.doc',
'application/msword', 'doc', '2000'),
],
[
- $this->create_file_content_node_array('d85b21c0f86cb0', 'Testing file 3.pdf',
+ self::create_file_content_node_array('d85b21c0f86cb0', 'Testing file 3.pdf',
'Testing file 3.pdf', '1000', '',
'https://googleusercontent.com/type/application/pdf', '', 'download'),
],
diff --git a/repository/googledocs/tests/helper_test.php b/repository/googledocs/tests/helper_test.php
index 2cf59fffae2..2af91467ab4 100644
--- a/repository/googledocs/tests/helper_test.php
+++ b/repository/googledocs/tests/helper_test.php
@@ -50,7 +50,7 @@ class helper_test extends \repository_googledocs_testcase {
*
* @return array
*/
- public function build_node_path_provider(): array {
+ public static function build_node_path_provider(): array {
$rootid = \repository_googledocs::REPOSITORY_ROOT_ID;
$mydriveid = \repository_googledocs::MY_DRIVE_ROOT_ID;
@@ -105,7 +105,7 @@ class helper_test extends \repository_googledocs_testcase {
*
* @return array
*/
- public function explode_node_path_provider(): array {
+ public static function explode_node_path_provider(): array {
$rootid = \repository_googledocs::REPOSITORY_ROOT_ID;
@@ -155,7 +155,7 @@ class helper_test extends \repository_googledocs_testcase {
*
* @return array
*/
- public function get_browser_provider(): array {
+ public static function get_browser_provider(): array {
$rootid = \repository_googledocs::REPOSITORY_ROOT_ID;
$mydriveid = \repository_googledocs::MY_DRIVE_ROOT_ID;
@@ -208,17 +208,16 @@ class helper_test extends \repository_googledocs_testcase {
*
* @return array
*/
- public function get_node_provider(): array {
-
+ public static function get_node_provider(): array {
return [
'The content object represents a Google Drive folder.' =>
[
- $this->create_google_drive_folder_object('e3b0c44298fc1c149', 'Folder', ''),
+ self::create_google_drive_folder_object('e3b0c44298fc1c149', 'Folder', ''),
\repository_googledocs\local\node\folder_node::class,
],
'The content object represents a Google Drive file.' =>
[
- $this->create_google_drive_file_object('de04d58dc5ccc', 'File.pdf',
+ self::create_google_drive_file_object('de04d58dc5ccc', 'File.pdf',
'application/pdf'),
\repository_googledocs\local\node\file_node::class,
],
@@ -253,7 +252,7 @@ class helper_test extends \repository_googledocs_testcase {
*
* @return array
*/
- public function request_exception_provider(): array {
+ public static function request_exception_provider(): array {
return [
'The API call throws exception (status: 403; message: Access Not Configured).' =>
diff --git a/repository/googledocs/tests/local/browser/googledocs_drive_content_test.php b/repository/googledocs/tests/local/browser/googledocs_drive_content_test.php
index 11d5d8b226e..fd49b64ea77 100644
--- a/repository/googledocs/tests/local/browser/googledocs_drive_content_test.php
+++ b/repository/googledocs/tests/local/browser/googledocs_drive_content_test.php
@@ -107,8 +107,7 @@ class googledocs_drive_content_test extends \googledocs_content_testcase {
*
* @return array
*/
- public function get_content_nodes_provider(): array {
-
+ public static function get_content_nodes_provider(): array {
$rootid = \repository_googledocs::REPOSITORY_ROOT_ID;
$mydriveid = \repository_googledocs::MY_DRIVE_ROOT_ID;
@@ -120,25 +119,25 @@ class googledocs_drive_content_test extends \googledocs_content_testcase {
true,
[],
[
- $this->create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
+ self::create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
],
[
- $this->create_google_drive_folder_object('1c4ad262c65333', 'Folder 2'),
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'File 3.pdf',
+ self::create_google_drive_folder_object('1c4ad262c65333', 'Folder 2'),
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'File 3.pdf',
'application/pdf', 'pdf', '1000'),
- $this->create_google_drive_folder_object('0c4ad262c65333', 'Folder 1'),
- $this->create_google_drive_file_object('bed5a0f08d412a', 'File 1.pdf',
+ self::create_google_drive_folder_object('0c4ad262c65333', 'Folder 1'),
+ self::create_google_drive_file_object('bed5a0f08d412a', 'File 1.pdf',
'application/pdf', 'pdf'),
],
[
- $this->create_folder_content_node_array('0c4ad262c65333', 'Folder 1',
+ self::create_folder_content_node_array('0c4ad262c65333', 'Folder 1',
"{$rootid}|Google+Drive/{$mydriveid}|My+Drive"),
- $this->create_folder_content_node_array('1c4ad262c65333', 'Folder 2',
+ self::create_folder_content_node_array('1c4ad262c65333', 'Folder 2',
"{$rootid}|Google+Drive/{$mydriveid}|My+Drive"),
- $this->create_file_content_node_array('bed5a0f08d412a', 'File 1.pdf', 'File 1.pdf',
+ self::create_file_content_node_array('bed5a0f08d412a', 'File 1.pdf', 'File 1.pdf',
null, '', 'https://googleusercontent.com/type/application/pdf', '',
'download'),
- $this->create_file_content_node_array('d85b21c0f86cb0', 'File 3.pdf', 'File 3.pdf',
+ self::create_file_content_node_array('d85b21c0f86cb0', 'File 3.pdf', 'File 3.pdf',
'1000', '', 'https://googleusercontent.com/type/application/pdf', '',
'download'),
],
@@ -151,16 +150,16 @@ class googledocs_drive_content_test extends \googledocs_content_testcase {
[],
[],
[
- $this->create_google_drive_folder_object('0c4ad262c65333', 'Folder 3'),
- $this->create_google_drive_folder_object('d85b21c0f86cb0', 'Folder 1'),
- $this->create_google_drive_folder_object('bed5a0f08d412a', 'Folder 2'),
+ self::create_google_drive_folder_object('0c4ad262c65333', 'Folder 3'),
+ self::create_google_drive_folder_object('d85b21c0f86cb0', 'Folder 1'),
+ self::create_google_drive_folder_object('bed5a0f08d412a', 'Folder 2'),
],
[
- $this->create_folder_content_node_array('0c4ad262c65333', 'Folder 3',
+ self::create_folder_content_node_array('0c4ad262c65333', 'Folder 3',
"{$rootid}|Google+Drive/{$mydriveid}|My+Drive"),
- $this->create_folder_content_node_array('d85b21c0f86cb0', 'Folder 1',
+ self::create_folder_content_node_array('d85b21c0f86cb0', 'Folder 1',
"{$rootid}|Google+Drive/{$mydriveid}|My+Drive"),
- $this->create_folder_content_node_array('bed5a0f08d412a', 'Folder 2',
+ self::create_folder_content_node_array('bed5a0f08d412a', 'Folder 2',
"{$rootid}|Google+Drive/{$mydriveid}|My+Drive"),
],
],
@@ -172,18 +171,18 @@ class googledocs_drive_content_test extends \googledocs_content_testcase {
['txt'],
[],
[
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'File 3.pdf',
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'File 3.pdf',
'application/pdf', 'pdf', '1000'),
- $this->create_google_drive_file_object('a85b21c0f86cb0', 'File 1.txt',
+ self::create_google_drive_file_object('a85b21c0f86cb0', 'File 1.txt',
'text/plain', 'txt', '3000'),
- $this->create_google_drive_file_object('f85b21c0f86cb0', 'File 2.doc',
+ self::create_google_drive_file_object('f85b21c0f86cb0', 'File 2.doc',
'application/msword', 'doc', '2000'),
],
[
- $this->create_file_content_node_array('d85b21c0f86cb0', 'File 3.pdf', 'File 3.pdf',
+ self::create_file_content_node_array('d85b21c0f86cb0', 'File 3.pdf', 'File 3.pdf',
'1000', '', 'https://googleusercontent.com/type/application/pdf', '',
'download'),
- $this->create_file_content_node_array('f85b21c0f86cb0', 'File 2.doc', 'File 2.doc',
+ self::create_file_content_node_array('f85b21c0f86cb0', 'File 2.doc', 'File 2.doc',
'2000', '', 'https://googleusercontent.com/type/application/msword', '',
'download'),
],
@@ -224,7 +223,7 @@ class googledocs_drive_content_test extends \googledocs_content_testcase {
*
* @return array
*/
- public function get_navigation_provider(): array {
+ public static function get_navigation_provider(): array {
$rootid = \repository_googledocs::REPOSITORY_ROOT_ID;
$mydriveid = \repository_googledocs::MY_DRIVE_ROOT_ID;
diff --git a/repository/googledocs/tests/local/browser/googledocs_root_content_test.php b/repository/googledocs/tests/local/browser/googledocs_root_content_test.php
index 5d51190ac71..462bcb60320 100644
--- a/repository/googledocs/tests/local/browser/googledocs_root_content_test.php
+++ b/repository/googledocs/tests/local/browser/googledocs_root_content_test.php
@@ -29,8 +29,7 @@ require_once($CFG->dirroot . '/repository/googledocs/lib.php');
* @copyright 2021 Mihail Geshoski
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class googledocs_root_content_test extends \googledocs_content_testcase {
-
+final class googledocs_root_content_test extends \googledocs_content_testcase {
/**
* Test get_content_nodes().
*
@@ -66,37 +65,34 @@ class googledocs_root_content_test extends \googledocs_content_testcase {
*
* @return array
*/
- public function get_content_nodes_provider(): array {
-
+ public static function get_content_nodes_provider(): array {
$rootid = \repository_googledocs::REPOSITORY_ROOT_ID;
$mydriveid = \repository_googledocs::MY_DRIVE_ROOT_ID;
$shareddrivesid = \repository_googledocs::SHARED_DRIVES_ROOT_ID;
return [
- 'Shared drives exist.' =>
+ 'Shared drives exist.' => [
[
- [
- $this->create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
- $this->create_google_drive_shared_drive_object('d85b21c0f86cb0', 'Shared Drive 3'),
- ],
- [
- $this->create_folder_content_node_array($mydriveid,
- get_string('mydrive', 'repository_googledocs'),
- "{$rootid}|Google+Drive"),
- $this->create_folder_content_node_array($shareddrivesid,
- get_string('shareddrives', 'repository_googledocs'),
- "{$rootid}|Google+Drive"),
- ],
+ self::create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
+ self::create_google_drive_shared_drive_object('d85b21c0f86cb0', 'Shared Drive 3'),
],
- 'Shared drives do not exist.' =>
[
- [],
- [
- $this->create_folder_content_node_array($mydriveid,
- get_string('mydrive', 'repository_googledocs'),
- "{$rootid}|Google+Drive"),
- ],
+ self::create_folder_content_node_array($mydriveid,
+ get_string('mydrive', 'repository_googledocs'),
+ "{$rootid}|Google+Drive"),
+ self::create_folder_content_node_array($shareddrivesid,
+ get_string('shareddrives', 'repository_googledocs'),
+ "{$rootid}|Google+Drive"),
],
+ ],
+ 'Shared drives do not exist.' => [
+ [],
+ [
+ self::create_folder_content_node_array($mydriveid,
+ get_string('mydrive', 'repository_googledocs'),
+ "{$rootid}|Google+Drive"),
+ ],
+ ],
];
}
}
diff --git a/repository/googledocs/tests/local/browser/googledocs_shared_drives_content_test.php b/repository/googledocs/tests/local/browser/googledocs_shared_drives_content_test.php
index 94ea029c9dd..9346392674f 100644
--- a/repository/googledocs/tests/local/browser/googledocs_shared_drives_content_test.php
+++ b/repository/googledocs/tests/local/browser/googledocs_shared_drives_content_test.php
@@ -29,8 +29,7 @@ require_once($CFG->dirroot . '/repository/googledocs/lib.php');
* @copyright 2021 Mihail Geshoski
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class googledocs_shared_drives_content_test extends \googledocs_content_testcase {
-
+final class googledocs_shared_drives_content_test extends \googledocs_content_testcase {
/**
* Test get_content_nodes().
*
@@ -68,8 +67,7 @@ class googledocs_shared_drives_content_test extends \googledocs_content_testcase
*
* @return array
*/
- public function get_content_nodes_provider(): array {
-
+ public static function get_content_nodes_provider(): array {
$rootid = \repository_googledocs::REPOSITORY_ROOT_ID;
$shareddrivesid = \repository_googledocs::SHARED_DRIVES_ROOT_ID;
$shareddrivesstring = get_string('shareddrives', 'repository_googledocs');
@@ -78,34 +76,34 @@ class googledocs_shared_drives_content_test extends \googledocs_content_testcase
'Shared drives exist; ordering applied.' =>
[
[
- $this->create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
- $this->create_google_drive_shared_drive_object('d85b21c0f86cb0', 'Shared Drive 3'),
- $this->create_google_drive_shared_drive_object('bed5a0f08d412a', 'Shared Drive 2'),
+ self::create_google_drive_shared_drive_object('d85b21c0f86cb5', 'Shared Drive 1'),
+ self::create_google_drive_shared_drive_object('d85b21c0f86cb0', 'Shared Drive 3'),
+ self::create_google_drive_shared_drive_object('bed5a0f08d412a', 'Shared Drive 2'),
],
true,
[
- $this->create_folder_content_node_array('d85b21c0f86cb5', 'Shared Drive 1',
+ self::create_folder_content_node_array('d85b21c0f86cb5', 'Shared Drive 1',
"{$rootid}|Google+Drive/{$shareddrivesid}|" . urlencode($shareddrivesstring)),
- $this->create_folder_content_node_array('bed5a0f08d412a', 'Shared Drive 2',
+ self::create_folder_content_node_array('bed5a0f08d412a', 'Shared Drive 2',
"{$rootid}|Google+Drive/{$shareddrivesid}|" . urlencode($shareddrivesstring)),
- $this->create_folder_content_node_array('d85b21c0f86cb0', 'Shared Drive 3',
+ self::create_folder_content_node_array('d85b21c0f86cb0', 'Shared Drive 3',
"{$rootid}|Google+Drive/{$shareddrivesid}|" . urlencode($shareddrivesstring)),
],
],
'Shared drives exist; ordering not applied.' =>
[
[
- $this->create_google_drive_shared_drive_object('0c4ad262c65333', 'Shared Drive 3'),
- $this->create_google_drive_shared_drive_object('d85b21c0f86cb0', 'Shared Drive 1'),
- $this->create_google_drive_shared_drive_object('bed5a0f08d412a', 'Shared Drive 2'),
+ self::create_google_drive_shared_drive_object('0c4ad262c65333', 'Shared Drive 3'),
+ self::create_google_drive_shared_drive_object('d85b21c0f86cb0', 'Shared Drive 1'),
+ self::create_google_drive_shared_drive_object('bed5a0f08d412a', 'Shared Drive 2'),
],
false,
[
- $this->create_folder_content_node_array('0c4ad262c65333', 'Shared Drive 3',
+ self::create_folder_content_node_array('0c4ad262c65333', 'Shared Drive 3',
"{$rootid}|Google+Drive/{$shareddrivesid}|" . urlencode($shareddrivesstring)),
- $this->create_folder_content_node_array('d85b21c0f86cb0', 'Shared Drive 1',
+ self::create_folder_content_node_array('d85b21c0f86cb0', 'Shared Drive 1',
"{$rootid}|Google+Drive/{$shareddrivesid}|" . urlencode($shareddrivesstring)),
- $this->create_folder_content_node_array('bed5a0f08d412a', 'Shared Drive 2',
+ self::create_folder_content_node_array('bed5a0f08d412a', 'Shared Drive 2',
"{$rootid}|Google+Drive/{$shareddrivesid}|" . urlencode($shareddrivesstring)),
],
],
diff --git a/repository/googledocs/tests/local/node/file_node_test.php b/repository/googledocs/tests/local/node/file_node_test.php
index 177bedc3268..96575c5eda4 100644
--- a/repository/googledocs/tests/local/node/file_node_test.php
+++ b/repository/googledocs/tests/local/node/file_node_test.php
@@ -28,8 +28,7 @@ require_once($CFG->dirroot . '/repository/googledocs/tests/repository_googledocs
* @copyright 2021 Mihail Geshoski
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class file_node_test extends \repository_googledocs_testcase {
-
+final class file_node_test extends \repository_googledocs_testcase {
/**
* Test create_node_array().
*
@@ -56,55 +55,54 @@ class file_node_test extends \repository_googledocs_testcase {
*
* @return array
*/
- public function create_node_array_provider(): array {
-
+ public static function create_node_array_provider(): array {
return [
'Google Drive file with an extension.' =>
[
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'File.pdf',
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'File.pdf',
'application/pdf', 'pdf', '1000', '01/01/21 0:30'),
[],
- $this->create_file_content_node_array('d85b21c0f86cb0', 'File.pdf', 'File.pdf', '1000',
+ self::create_file_content_node_array('d85b21c0f86cb0', 'File.pdf', 'File.pdf', '1000',
'1609432200', 'https://googleusercontent.com/type/application/pdf', '',
'download'),
],
'Google Drive file that has webContentLink and webViewLink.' =>
[
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'File.pdf',
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'File.pdf',
'application/pdf', 'pdf', null, '',
'https://drive.google.com/uc?id=d85b21c0f86cb0&export=download',
'https://drive.google.com/file/d/d85b21c0f86cb0/view?usp=drivesdk'),
[
'documentformat' => 'rtf',
],
- $this->create_file_content_node_array('d85b21c0f86cb0', 'File.pdf', 'File.pdf', null,
+ self::create_file_content_node_array('d85b21c0f86cb0', 'File.pdf', 'File.pdf', null,
'', 'https://googleusercontent.com/type/application/pdf',
'https://drive.google.com/file/d/d85b21c0f86cb0/view?usp=drivesdk', 'download'),
],
'Google Drive file that has webContentLink and no webViewLink.' =>
[
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'File.pdf',
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'File.pdf',
'application/pdf', 'pdf', null, '',
'https://drive.google.com/uc?id=d85b21c0f86cb0&export=download', ''),
[],
- $this->create_file_content_node_array('d85b21c0f86cb0', 'File.pdf', 'File.pdf', null,
+ self::create_file_content_node_array('d85b21c0f86cb0', 'File.pdf', 'File.pdf', null,
'', 'https://googleusercontent.com/type/application/pdf',
'https://drive.google.com/uc?id=d85b21c0f86cb0&export=download', 'download'),
],
'Google Drive file without an extension (Google document file; documentformat config set to rtf).' =>
[
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'File',
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'File',
'application/vnd.google-apps.document', null),
[
'documentformat' => 'rtf',
],
- $this->create_file_content_node_array('d85b21c0f86cb0', 'File', 'File.gdoc', '', '',
+ self::create_file_content_node_array('d85b21c0f86cb0', 'File', 'File.gdoc', '', '',
'https://googleusercontent.com/type/application/vnd.google-apps.document', '',
'application/rtf', 'document'),
],
'Google Drive file without an extension (Google presentation file; presentationformat config not set).' =>
[
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'File',
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'File',
'application/vnd.google-apps.presentation', null),
[
'documentformat' => 'rtf',
@@ -113,7 +111,7 @@ class file_node_test extends \repository_googledocs_testcase {
],
'Google Drive file without an extension (File type not supported).' =>
[
- $this->create_google_drive_file_object('d85b21c0f86cb0', 'File',
+ self::create_google_drive_file_object('d85b21c0f86cb0', 'File',
'application/vnd.google-apps.unknownmimetype', null),
[],
null,
diff --git a/repository/googledocs/tests/local/node/folder_node_test.php b/repository/googledocs/tests/local/node/folder_node_test.php
index d041b367797..34502e55623 100644
--- a/repository/googledocs/tests/local/node/folder_node_test.php
+++ b/repository/googledocs/tests/local/node/folder_node_test.php
@@ -50,23 +50,26 @@ class folder_node_test extends \repository_googledocs_testcase {
*
* @return array
*/
- public function create_node_array_provider(): array {
-
+ public static function create_node_array_provider(): array {
$rootid = \repository_googledocs::REPOSITORY_ROOT_ID;
return [
'Google Drive folder with modified date.' =>
[
- $this->create_google_drive_folder_object('d85b21c0f86cb0', 'Folder', '01/01/21 0:30'),
+ self::create_google_drive_folder_object('d85b21c0f86cb0', 'Folder', '01/01/21 0:30'),
"{$rootid}|Google+Drive",
- $this->create_folder_content_node_array('d85b21c0f86cb0', 'Folder',
- "{$rootid}|Google+Drive", '1609432200'),
+ self::create_folder_content_node_array(
+ 'd85b21c0f86cb0',
+ 'Folder',
+ "{$rootid}|Google+Drive",
+ '1609432200',
+ ),
],
'Google Drive folder without modified date.' =>
[
- $this->create_google_drive_folder_object('d85b21c0f86cb0', 'Folder', ''),
+ self::create_google_drive_folder_object('d85b21c0f86cb0', 'Folder', ''),
'',
- $this->create_folder_content_node_array('d85b21c0f86cb0', 'Folder', '', ''),
+ self::create_folder_content_node_array('d85b21c0f86cb0', 'Folder', '', ''),
],
];
}
diff --git a/repository/googledocs/tests/repository_googledocs_testcase.php b/repository/googledocs/tests/repository_googledocs_testcase.php
index 8b9c0707b1d..1de7ca58910 100644
--- a/repository/googledocs/tests/repository_googledocs_testcase.php
+++ b/repository/googledocs/tests/repository_googledocs_testcase.php
@@ -32,9 +32,12 @@ abstract class repository_googledocs_testcase extends \advanced_testcase {
* @param string $modified The date of the last modification
* @return array The repository folder node array
*/
- protected function create_folder_content_node_array(string $id, string $name, string $path,
- string $modified = ''): array {
-
+ protected static function create_folder_content_node_array(
+ string $id,
+ string $name,
+ string $path,
+ string $modified = '',
+ ): array {
global $CFG, $OUTPUT;
return [
@@ -63,10 +66,17 @@ abstract class repository_googledocs_testcase extends \advanced_testcase {
* @param string|null $googledoctype The type of the Google Doc file (if applicable)
* @return array The repository file node array
*/
- protected function create_file_content_node_array(string $id, string $name, string $title, ?string $size = null,
- string $modified = '', string $thumbnail = '' , string $link = '', string $exportformat = '',
- ?string $googledoctype = null): array {
-
+ protected static function create_file_content_node_array(
+ string $id,
+ string $name,
+ string $title,
+ ?string $size = null,
+ string $modified = '',
+ string $thumbnail = '',
+ string $link = '',
+ string $exportformat = '',
+ ?string $googledoctype = null,
+ ): array {
return [
'id' => $id,
'title' => $title,
@@ -75,7 +85,7 @@ abstract class repository_googledocs_testcase extends \advanced_testcase {
'name' => $name,
'link' => $link,
'exportformat' => $exportformat,
- 'googledoctype' => $googledoctype
+ 'googledoctype' => $googledoctype,
]),
'date' => $modified,
'size' => $size,
@@ -92,8 +102,8 @@ abstract class repository_googledocs_testcase extends \advanced_testcase {
* @param string $name The name of the shared drive
* @return \stdClass The shared drive object
*/
- protected function create_google_drive_shared_drive_object(string $id, string $name): \stdClass {
- return (object)[
+ protected static function create_google_drive_shared_drive_object(string $id, string $name): \stdClass {
+ return (object) [
'kind' => 'drive#drive',
'id' => $id,
'name' => $name,
@@ -108,7 +118,7 @@ abstract class repository_googledocs_testcase extends \advanced_testcase {
* @param string|null $modified The date of the last modification
* @return \stdClass The folder object
*/
- protected function create_google_drive_folder_object(string $id, string $name, ?string $modified = null): \stdClass {
+ protected static function create_google_drive_folder_object(string $id, string $name, ?string $modified = null): \stdClass {
return (object)[
'id' => $id,
'name' => $name,
@@ -132,10 +142,16 @@ abstract class repository_googledocs_testcase extends \advanced_testcase {
* @param string|null $webviewlink The link for opening the file in a browser
* @return \stdClass The file object
*/
- protected function create_google_drive_file_object(string $id, string $name, string $mimetype,
- ?string $extension = null, ?string $size = null, ?string $modified = null, ?string $webcontentlink = null,
- ?string $webviewlink = null): \stdClass {
-
+ protected static function create_google_drive_file_object(
+ string $id,
+ string $name,
+ string $mimetype,
+ ?string $extension = null,
+ ?string $size = null,
+ ?string $modified = null,
+ ?string $webcontentlink = null,
+ ?string $webviewlink = null,
+ ): \stdClass {
$googledrivefile = [
'id' => $id,
'name' => $name,
diff --git a/repository/nextcloud/tests/lib_test.php b/repository/nextcloud/tests/lib_test.php
index a266f875529..59304203a4d 100644
--- a/repository/nextcloud/tests/lib_test.php
+++ b/repository/nextcloud/tests/lib_test.php
@@ -853,7 +853,7 @@ XML;
*
* @return array[]
*/
- public function sync_reference_provider(): array {
+ public static function sync_reference_provider(): array {
return [
'referecncelastsync done recently' => [
[
diff --git a/search/engine/solr/tests/engine_test.php b/search/engine/solr/tests/engine_test.php
index ace0527f225..b0a1725d1b8 100644
--- a/search/engine/solr/tests/engine_test.php
+++ b/search/engine/solr/tests/engine_test.php
@@ -46,8 +46,7 @@ require_once($CFG->dirroot . '/search/engine/solr/tests/fixtures/testable_engine
*
* @runTestsInSeparateProcesses
*/
-class engine_test extends \advanced_testcase {
-
+final class engine_test extends \advanced_testcase {
/**
* @var \core_search\manager
*/
@@ -145,7 +144,7 @@ class engine_test extends \advanced_testcase {
/**
* Simple data provider to allow tests to be run with file indexing on and off.
*/
- public function file_indexing_provider() {
+ public static function file_indexing_provider(): array {
return array(
'file-indexing-on' => array(1),
'file-indexing-off' => array(0)
diff --git a/search/tests/document_test.php b/search/tests/document_test.php
index ff91ccae2f4..aba3215f651 100644
--- a/search/tests/document_test.php
+++ b/search/tests/document_test.php
@@ -213,7 +213,7 @@ class document_test extends \advanced_testcase {
*
* @return array
*/
- public function document_author_visibility_provider(): array {
+ public static function document_author_visibility_provider(): array {
return [
'Teacher' => [
'rolename' => 'editingteacher',
diff --git a/search/tests/manager_test.php b/search/tests/manager_test.php
index a24cef37161..f9d916c2726 100644
--- a/search/tests/manager_test.php
+++ b/search/tests/manager_test.php
@@ -107,7 +107,7 @@ class manager_test extends \advanced_testcase {
*
* @return array[]
*/
- public function data_course_search_url(): array {
+ public static function data_course_search_url(): array {
return [
'defaults' => [null, null, null, '/course/search.php'],
'enabled' => [true, true, true, '/search/index.php'],
@@ -156,7 +156,7 @@ class manager_test extends \advanced_testcase {
*
* @return array[]
*/
- public function data_can_replace_course_search(): array {
+ public static function data_can_replace_course_search(): array {
return [
'defaults' => [null, null, null, false],
'enabled' => [true, true, true, true],
@@ -1504,7 +1504,7 @@ class manager_test extends \advanced_testcase {
*
* @return array
*/
- public function parse_search_area_id_data_provider() {
+ public static function parse_search_area_id_data_provider(): array {
return [
['mod_book-chapter', ['mod_book', 'search_chapter']],
['mod_customcert-activity', ['mod_customcert', 'search_activity']],
diff --git a/sms/gateway/aws/tests/helper_test.php b/sms/gateway/aws/tests/helper_test.php
index 9729422557b..8410ece3e45 100644
--- a/sms/gateway/aws/tests/helper_test.php
+++ b/sms/gateway/aws/tests/helper_test.php
@@ -32,7 +32,7 @@ class helper_test extends \advanced_testcase {
*
* @return array of different country codes and phone numbers.
*/
- public function format_number_provider(): array {
+ public static function format_number_provider(): array {
return [
'Phone number with local format' => [
diff --git a/tag/tests/reportbuilder/datasource/tags_test.php b/tag/tests/reportbuilder/datasource/tags_test.php
index 8a1aaec39b2..417feb9d9ff 100644
--- a/tag/tests/reportbuilder/datasource/tags_test.php
+++ b/tag/tests/reportbuilder/datasource/tags_test.php
@@ -162,7 +162,7 @@ class tags_test extends core_reportbuilder_testcase {
*
* @return array[]
*/
- public function datasource_filters_provider(): array {
+ public static function datasource_filters_provider(): array {
return [
// Collection.
'Filter collection name' => ['collection:name', [
diff --git a/theme/boost/tests/boostnavbar_test.php b/theme/boost/tests/boostnavbar_test.php
index f5d062beaa3..0afb84eab4f 100644
--- a/theme/boost/tests/boostnavbar_test.php
+++ b/theme/boost/tests/boostnavbar_test.php
@@ -31,7 +31,7 @@ class boostnavbar_test extends \advanced_testcase {
*
* @return array
*/
- public function remove_no_link_items_provider(): array {
+ public static function remove_no_link_items_provider(): array {
return [
'All nodes have links links including leaf node. Set to remove section nodes.' => [
[
@@ -229,7 +229,7 @@ class boostnavbar_test extends \advanced_testcase {
*
* @return array
*/
- public function remove_duplicate_items_provider(): array {
+ public static function remove_duplicate_items_provider(): array {
global $CFG;
return [
@@ -407,7 +407,7 @@ class boostnavbar_test extends \advanced_testcase {
*
* @return array
*/
- public function remove_items_that_exist_in_navigation_provider(): array {
+ public static function remove_items_that_exist_in_navigation_provider(): array {
global $CFG;
return [
diff --git a/theme/boost/tests/privacy/provider_test.php b/theme/boost/tests/privacy/provider_test.php
index 4655f3b5f5a..7da1d3e7a4f 100644
--- a/theme/boost/tests/privacy/provider_test.php
+++ b/theme/boost/tests/privacy/provider_test.php
@@ -35,7 +35,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
*
* @return array[]
*/
- public function export_user_preference_provider(): array {
+ public static function export_user_preference_provider(): array {
return [
'Index drawer open' => [provider::DRAWER_OPEN_INDEX, true, 'privacy:drawerindexopen'],
'Index drawer closed' => [provider::DRAWER_OPEN_INDEX, false, 'privacy:drawerindexclosed'],
diff --git a/user/profile/field/text/tests/field_class_test.php b/user/profile/field/text/tests/field_class_test.php
index e0936f845ac..23a987f798d 100644
--- a/user/profile/field/text/tests/field_class_test.php
+++ b/user/profile/field/text/tests/field_class_test.php
@@ -60,7 +60,7 @@ class field_class_test extends \advanced_testcase {
*
* @return string[]
*/
- public function filter_profile_field_text_provider(): array {
+ public static function filter_profile_field_text_provider(): array {
return [
'simple_string' => ['Simple string', 'Simple string'],
'format_string' => ['HTML & is escaped', 'HTML & is escaped'],
diff --git a/user/tests/externallib_test.php b/user/tests/externallib_test.php
index 8d9ae6fd6cd..ba4ac134a70 100644
--- a/user/tests/externallib_test.php
+++ b/user/tests/externallib_test.php
@@ -612,7 +612,7 @@ final class externallib_test extends externallib_advanced_testcase {
/**
* Data provider for \core_user_externallib_testcase::test_create_users_with_same_emails().
*/
- public function create_users_provider_with_same_emails() {
+ public static function create_users_provider_with_same_emails(): array {
return [
'Same emails allowed, same case' => [
1, false
@@ -698,7 +698,7 @@ final class externallib_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function data_create_users_invalid_parameter() {
+ public static function data_create_users_invalid_parameter(): array {
return [
'blank_username' => [
'data' => [
@@ -957,7 +957,7 @@ final class externallib_test extends externallib_advanced_testcase {
*
* @return array
*/
- public function users_with_same_emails() {
+ public static function users_with_same_emails(): array {
return [
'Same emails not allowed: Update name using exactly the same email' => [
0, 'John', 's1@example.com', 'Johnny', 's1@example.com', false, true
diff --git a/user/tests/fields_test.php b/user/tests/fields_test.php
index 59cf7991c64..240ddfb7989 100644
--- a/user/tests/fields_test.php
+++ b/user/tests/fields_test.php
@@ -549,7 +549,7 @@ class fields_test extends \advanced_testcase {
*
* @return array
*/
- public function get_sql_fullname_provider(): array {
+ public static function get_sql_fullname_provider(): array {
return [
['firstname lastname', 'FN LN'],
['lastname, firstname', 'LN, FN'],
diff --git a/user/tests/profilelib_test.php b/user/tests/profilelib_test.php
index 3720fae9eff..05417365771 100644
--- a/user/tests/profilelib_test.php
+++ b/user/tests/profilelib_test.php
@@ -282,7 +282,7 @@ class profilelib_test extends \advanced_testcase {
*
* @return array[]
*/
- public function profile_get_custom_field_data_by_shortname_case_sensitivity_provider(): array {
+ public static function profile_get_custom_field_data_by_shortname_case_sensitivity_provider(): array {
return [
'Matching case, case-sensitive search' => ['hello', 'hello', true, true],
'Matching case, case-insensitive search' => ['hello', 'hello', false, true],
diff --git a/user/tests/table/participants_search_test.php b/user/tests/table/participants_search_test.php
index 9b0ff9cd864..c9a92691669 100644
--- a/user/tests/table/participants_search_test.php
+++ b/user/tests/table/participants_search_test.php
@@ -799,7 +799,7 @@ final class participants_search_test extends advanced_testcase {
*
* @return array
*/
- public function country_provider(): array {
+ public static function country_provider(): array {
$tests = [
'users' => [
'user1' => 'DE',
@@ -996,7 +996,7 @@ final class participants_search_test extends advanced_testcase {
*
* @return array
*/
- public function keywords_provider(): array {
+ public static function keywords_provider(): array {
$tests = [
// Users where the keyword matches basic user fields such as names and email.
'Users with basic names' => (object) [
@@ -1544,7 +1544,7 @@ final class participants_search_test extends advanced_testcase {
*
* @return array
*/
- public function status_provider(): array {
+ public static function status_provider(): array {
$tests = [
// Users with different statuses and enrolment methods (so multiple statuses are possible for the same user).
'Users with different enrolment statuses' => (object) [
@@ -1801,7 +1801,7 @@ final class participants_search_test extends advanced_testcase {
*
* @return array
*/
- public function enrolments_provider(): array {
+ public static function enrolments_provider(): array {
$tests = [
// Users with different enrolment methods.
'Users with different enrolment methods' => (object) [
@@ -2027,7 +2027,7 @@ final class participants_search_test extends advanced_testcase {
*
* @return array
*/
- public function groups_provider(): array {
+ public static function groups_provider(): array {
$tests = [
'Users in different groups' => (object) [
'groupsavailable' => [
@@ -2368,7 +2368,7 @@ final class participants_search_test extends advanced_testcase {
*
* @return array
*/
- public function groups_separate_provider(): array {
+ public static function groups_separate_provider(): array {
$tests = [
'Users in different groups with separate groups mode enabled' => (object) [
'groupsavailable' => [
@@ -2730,7 +2730,7 @@ final class participants_search_test extends advanced_testcase {
*
* @return array
*/
- public function accesssince_provider(): array {
+ public static function accesssince_provider(): array {
$tests = [
// Users with different last access times.
'Users in different groups' => (object) [
@@ -3137,7 +3137,7 @@ final class participants_search_test extends advanced_testcase {
*
* @return array
*/
- public function filterset_joins_provider(): array {
+ public static function filterset_joins_provider(): array {
$tests = [
// Users with different configurations.
'Users with different configurations' => (object) [
diff --git a/user/tests/userlib_test.php b/user/tests/userlib_test.php
index 181f19d1a89..ef43172ede8 100644
--- a/user/tests/userlib_test.php
+++ b/user/tests/userlib_test.php
@@ -386,7 +386,7 @@ class userlib_test extends \advanced_testcase {
*
* @return array
*/
- public function data_create_user_invalid_username() {
+ public static function data_create_user_invalid_username(): array {
return [
'empty_string' => [
'',
diff --git a/webservice/rest/tests/server_test.php b/webservice/rest/tests/server_test.php
index f97812eb990..b1c50e4ca57 100644
--- a/webservice/rest/tests/server_test.php
+++ b/webservice/rest/tests/server_test.php
@@ -32,13 +32,12 @@ require_once($CFG->dirroot . '/webservice/rest/locallib.php');
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class server_test extends \advanced_testcase {
-
+final class server_test extends \advanced_testcase {
/**
* Data provider for test_xmlize.
* @return array
*/
- public function xmlize_provider() {
+ public static function xmlize_provider(): array {
$data = [];
$data[] = [null, null, ''];
$data[] = [new external_value(PARAM_BOOL), false, "0\n"];
@@ -209,5 +208,4 @@ class server_test extends \advanced_testcase {
$method = new \ReflectionMethod('webservice_rest_server', 'xmlize_result');
$this->assertEquals($expected, $method->invoke(null, $value, $description));
}
-
}
diff --git a/webservice/tests/lib_test.php b/webservice/tests/lib_test.php
index 29be23e83cd..010f7506f63 100644
--- a/webservice/tests/lib_test.php
+++ b/webservice/tests/lib_test.php
@@ -269,7 +269,7 @@ class lib_test extends \advanced_testcase {
*
* @return array
*/
- public function get_active_tokens_provider(): array {
+ public static function get_active_tokens_provider(): array {
return [
'No expiration' => [0, true],
'Active' => [time() + DAYSECS, true],