From d81a94807b44d094309b30ff1e068173dea65689 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 2 Aug 2020 10:59:12 +0200 Subject: [PATCH] MDL-67673 phpunit: Fix the return type of template methods All the setup/teardown/pre/post/conditions template methods now are required to return void. This was warned with phpunit 7 and now is enforced. At the same time, fix a few wrong function names, provider data and param types, return statements... --- admin/tool/behat/tests/manager_util_test.php | 2 +- admin/tool/capability/tests/events_test.php | 2 +- admin/tool/cohortroles/tests/api_test.php | 2 +- admin/tool/cohortroles/tests/privacy_test.php | 2 +- .../tool/dataprivacy/tests/expired_data_requests_test.php | 2 +- admin/tool/dataprivacy/tests/task_test.php | 2 +- admin/tool/langimport/tests/events_test.php | 2 +- admin/tool/log/store/database/tests/privacy_test.php | 2 +- admin/tool/log/store/legacy/tests/privacy_test.php | 2 +- admin/tool/log/store/standard/tests/privacy_test.php | 2 +- admin/tool/log/store/standard/tests/store_test.php | 2 +- admin/tool/log/tests/privacy_test.php | 2 +- admin/tool/lp/tests/externallib_test.php | 2 +- admin/tool/lpmigrate/tests/processor_test.php | 2 +- admin/tool/messageinbound/tests/manager_test.php | 2 +- admin/tool/messageinbound/tests/privacy_test.php | 2 +- admin/tool/mobile/tests/privacy_provider_test.php | 2 +- admin/tool/monitor/tests/eventobservers_test.php | 2 +- admin/tool/monitor/tests/events_test.php | 2 +- admin/tool/monitor/tests/generator_test.php | 4 ++-- admin/tool/monitor/tests/privacy_test.php | 2 +- admin/tool/monitor/tests/rule_manager_test.php | 4 ++-- admin/tool/monitor/tests/subscription_test.php | 2 +- .../tool/monitor/tests/task_check_subscriptions_test.php | 2 +- admin/tool/monitor/tests/task_clean_events_test.php | 2 +- admin/tool/policy/tests/externallib_test.php | 2 +- admin/tool/policy/tests/privacy_provider_test.php | 2 +- admin/tool/recyclebin/tests/category_bin_test.php | 2 +- admin/tool/recyclebin/tests/course_bin_test.php | 2 +- admin/tool/recyclebin/tests/events_test.php | 2 +- admin/tool/usertours/tests/accessdate_filter_test.php | 2 +- admin/tool/usertours/tests/manager_test.php | 4 ++-- admin/tool/usertours/tests/role_filter_test.php | 2 +- admin/tool/usertours/tests/step_test.php | 4 ++-- admin/tool/usertours/tests/tour_test.php | 4 ++-- analytics/tests/course_test.php | 2 +- analytics/tests/dataset_manager_test.php | 2 +- analytics/tests/model_test.php | 2 +- analytics/tests/prediction_actions_test.php | 2 +- analytics/tests/prediction_test.php | 2 +- analytics/tests/privacy_test.php | 2 +- analytics/tests/stats_test.php | 2 +- auth/email/tests/external_test.php | 2 +- auth/manual/tests/manual_test.php | 2 +- auth/manual/tests/privacy_provider_test.php | 2 +- auth/mnet/tests/privacy_provider_test.php | 2 +- auth/oauth2/tests/privacy_provider_test.php | 2 +- auth/tests/external_test.php | 4 ++-- auth/tests/privacy_test.php | 2 +- .../condition/completion/tests/condition_test.php | 2 +- availability/condition/date/tests/condition_test.php | 2 +- availability/condition/group/tests/condition_test.php | 2 +- availability/condition/grouping/tests/condition_test.php | 2 +- availability/condition/profile/tests/condition_test.php | 2 +- availability/tests/info_test.php | 2 +- availability/tests/tree_test.php | 2 +- backup/controller/tests/controller_test.php | 2 +- backup/converter/moodle1/tests/moodle1_converter_test.php | 4 ++-- backup/moodle2/tests/backup_encrypted_content_test.php | 2 +- backup/moodle2/tests/backup_xml_transformer_test.php | 2 +- backup/tests/automated_backup_test.php | 2 +- backup/tests/course_copy_test.php | 4 ++-- backup/tests/externallib_test.php | 4 ++-- backup/util/checks/tests/checks_test.php | 2 +- backup/util/dbops/tests/backup_dbops_test.php | 2 +- backup/util/factories/tests/factories_test.php | 4 ++-- .../tests/restore_structure_parser_processor_test.php | 2 +- backup/util/plan/tests/plan_test.php | 2 +- backup/util/plan/tests/step_test.php | 2 +- backup/util/plan/tests/task_test.php | 2 +- backup/util/structure/tests/structure_test.php | 2 +- badges/tests/badgeslib_test.php | 2 +- badges/tests/external_test.php | 2 +- badges/tests/privacy_test.php | 2 +- blocks/comments/tests/events_test.php | 2 +- blocks/comments/tests/privacy_provider_test.php | 2 +- blocks/online_users/tests/online_users_test.php | 2 +- blocks/recentlyaccesseditems/tests/observer_test.php | 4 ++-- blocks/rss_client/tests/privacy_test.php | 2 +- blocks/tests/privacy_test.php | 2 +- blog/tests/events_test.php | 2 +- blog/tests/external_test.php | 2 +- blog/tests/lib_test.php | 2 +- blog/tests/privacy_test.php | 2 +- cache/stores/apcu/tests/apcu_test.php | 6 +++--- cache/stores/redis/tests/compressor_test.php | 2 +- cache/stores/redis/tests/redis_test.php | 6 +++--- cache/tests/administration_helper_test.php | 4 ++-- cache/tests/cache_test.php | 4 ++-- cache/tests/config_writer_test.php | 4 ++-- cache/tests/fixtures/stores.php | 4 ++-- calendar/tests/calendartype_test.php | 2 +- calendar/tests/container_test.php | 2 +- calendar/tests/events_related_objects_cache_test.php | 2 +- calendar/tests/events_test.php | 2 +- calendar/tests/externallib_test.php | 2 +- calendar/tests/lib_test.php | 2 +- calendar/tests/local_api_test.php | 2 +- calendar/tests/privacy_test.php | 2 +- calendar/tests/rrule_manager_test.php | 2 +- calendar/tests/std_proxy_test.php | 2 +- cohort/tests/privacy_test.php | 2 +- comment/tests/externallib_test.php | 2 +- comment/tests/privacy_test.php | 2 +- competency/tests/external_test.php | 2 +- competency/tests/privacy_test.php | 2 +- completion/tests/api_test.php | 2 +- completion/tests/progress_test.php | 2 +- course/format/weeks/tests/observer_test.php | 2 +- course/tests/category_hooks_test.php | 2 +- course/tests/category_test.php | 2 +- course/tests/customfield_test.php | 2 +- course/tests/events_test.php | 2 +- course/tests/externallib_test.php | 2 +- course/tests/search_test.php | 2 +- customfield/field/checkbox/tests/plugin_test.php | 2 +- customfield/field/date/tests/plugin_test.php | 4 ++-- customfield/field/select/tests/plugin_test.php | 4 ++-- customfield/field/text/tests/plugin_test.php | 2 +- customfield/field/textarea/tests/plugin_test.php | 2 +- enrol/flatfile/tests/privacy_provider_test.php | 2 +- enrol/imsenterprise/tests/imsenterprise_test.php | 2 +- enrol/lti/tests/data_connector_test.php | 2 +- enrol/lti/tests/helper_test.php | 2 +- enrol/lti/tests/lib_test.php | 2 +- enrol/lti/tests/privacy_provider_test.php | 2 +- enrol/lti/tests/sync_members_test.php | 2 +- enrol/lti/tests/tool_provider_test.php | 2 +- enrol/paypal/tests/privacy_provider_test.php | 2 +- enrol/tests/course_enrolment_manager_test.php | 2 +- enrol/tests/role_external_test.php | 4 ++-- favourites/tests/component_favourite_service_test.php | 2 +- favourites/tests/privacy_test.php | 2 +- favourites/tests/repository_test.php | 2 +- favourites/tests/user_favourite_service_test.php | 2 +- filter/algebra/tests/filter_test.php | 2 +- filter/displayh5p/tests/filter_test.php | 4 ++-- filter/multilang/tests/filter_test.php | 2 +- filter/tex/tests/filter_test.php | 2 +- grade/export/ods/tests/logging_test.php | 4 ++-- grade/export/txt/tests/logging_test.php | 4 ++-- grade/export/xls/tests/logging_test.php | 4 ++-- grade/export/xml/tests/logging_test.php | 4 ++-- grade/import/csv/tests/load_data_test.php | 2 +- grade/report/grader/tests/privacy_test.php | 2 +- grade/report/overview/tests/externallib_test.php | 2 +- grade/report/user/tests/lib_test.php | 2 +- grade/report/user/tests/privacy_test.php | 2 +- grade/tests/events_test.php | 2 +- ...ades_grader_gradingpanel_point_external_store_test.php | 2 +- grade/tests/privacy_test.php | 2 +- h5p/tests/editor_ajax_test.php | 2 +- h5p/tests/editor_framework_test.php | 2 +- h5p/tests/event_h5p_deleted_test.php | 2 +- h5p/tests/event_h5p_viewed_test.php | 2 +- h5p/tests/external_test.php | 2 +- h5p/tests/framework_test.php | 2 +- h5p/tests/generator_test.php | 2 +- h5p/tests/h5p_core_test.php | 2 +- h5p/tests/h5p_file_storage_test.php | 2 +- iplookup/tests/geoip_test.php | 2 +- iplookup/tests/geoplugin_test.php | 2 +- lib/antivirus/clamav/tests/scanner_test.php | 4 ++-- lib/ddl/tests/ddl_test.php | 2 +- lib/dml/tests/dml_test.php | 2 +- lib/dml/tests/pgsql_native_recordset_test.php | 4 ++-- lib/dml/tests/recordset_walk_test.php | 2 +- lib/dml/tests/sqlsrv_native_moodle_database_test.php | 2 +- lib/filebrowser/tests/file_browser_test.php | 2 +- lib/filestorage/tests/file_system_filedir_test.php | 4 ++-- lib/filestorage/tests/file_system_test.php | 4 ++-- lib/filestorage/tests/zip_packer_test.php | 2 +- lib/form/tests/dateselector_test.php | 2 +- lib/form/tests/datetimeselector_test.php | 2 +- lib/grade/tests/fixtures/lib.php | 2 +- lib/phpunit/classes/database_driver_testcase.php | 8 ++++---- lib/phpunit/classes/restore_date_testcase.php | 4 ++-- lib/phpunit/tests/basic_test.php | 2 +- lib/tests/ajaxlib_test.php | 4 ++-- lib/tests/antivirus_test.php | 4 ++-- lib/tests/blocklib_test.php | 4 ++-- lib/tests/calendar_cron_task_test.php | 2 +- lib/tests/collator_test.php | 4 ++-- lib/tests/component_test.php | 4 ++-- lib/tests/core_media_player_native.php | 4 ++-- lib/tests/csvclass_test.php | 2 +- lib/tests/customcontext_test.php | 2 +- lib/tests/event/contentbank_content_created_test.php | 2 +- lib/tests/event/contentbank_content_deleted_test.php | 2 +- lib/tests/event/contentbank_content_updated_test.php | 2 +- lib/tests/event/contentbank_content_uploaded_test.php | 2 +- lib/tests/event/contentbank_content_viewed_test.php | 2 +- lib/tests/event_profile_field_test.php | 2 +- lib/tests/event_user_graded_test.php | 2 +- lib/tests/events_test.php | 2 +- lib/tests/exporter_test.php | 2 +- lib/tests/externallib_test.php | 4 ++-- lib/tests/gdlib_test.php | 2 +- lib/tests/h5p_get_content_types_task_test.php | 2 +- lib/tests/lock_test.php | 2 +- lib/tests/medialib_test.php | 4 ++-- lib/tests/moodle_page_test.php | 2 +- lib/tests/myprofilelib_test.php | 2 +- lib/tests/notification_test.php | 4 ++-- lib/tests/persistent_test.php | 2 +- lib/tests/plugin_manager_test.php | 2 +- lib/tests/plugininfo/base_test.php | 2 +- lib/tests/questionlib_test.php | 2 +- lib/tests/rsslib_test.php | 2 +- lib/tests/session_redis_test.php | 4 ++-- lib/tests/statslib_test.php | 2 +- lib/tests/task_database_logger_test.php | 4 ++-- lib/tests/task_logging_test.php | 2 +- lib/tests/time_splittings_test.php | 2 +- lib/tests/user_test.php | 2 +- lib/tests/useragent_test.php | 2 +- lib/xapi/tests/external/post_statement_test.php | 2 +- media/player/html5audio/tests/player_test.php | 2 +- media/player/html5video/tests/player_test.php | 2 +- media/player/swf/tests/player_test.php | 2 +- media/player/videojs/tests/player_test.php | 2 +- media/player/vimeo/tests/player_test.php | 2 +- media/player/youtube/tests/player_test.php | 2 +- message/output/airnotifier/tests/externallib_test.php | 2 +- message/output/airnotifier/tests/privacy_test.php | 2 +- message/output/email/tests/privacy_test.php | 2 +- message/output/jabber/tests/privacy_test.php | 2 +- message/output/popup/tests/api_test.php | 2 +- message/output/popup/tests/externallib_test.php | 2 +- message/tests/events_test.php | 2 +- message/tests/externallib_test.php | 2 +- message/tests/helper_test.php | 2 +- message/tests/inbound_test.php | 2 +- message/tests/messagelib_test.php | 2 +- message/tests/migrate_message_data_task_test.php | 2 +- message/tests/search_received_test.php | 2 +- message/tests/search_sent_test.php | 2 +- mnet/service/enrol/tests/privacy_test.php | 4 ++-- mnet/tests/events_test.php | 2 +- mod/assign/feedback/editpdf/tests/privacy_test.php | 2 +- mod/assign/tests/base_test.php | 2 +- mod/book/tests/events_test.php | 2 +- mod/book/tests/lib_test.php | 2 +- mod/book/tests/search_test.php | 2 +- mod/book/tool/exportimscp/tests/events_test.php | 2 +- mod/book/tool/importhtml/tests/locallib_test.php | 2 +- mod/book/tool/print/tests/events_test.php | 2 +- mod/chat/tests/lib_test.php | 2 +- mod/chat/tests/privacy_test.php | 2 +- mod/choice/tests/events_test.php | 2 +- mod/choice/tests/privacy_provider_test.php | 2 +- mod/data/tests/events_test.php | 2 +- mod/data/tests/externallib_test.php | 2 +- mod/data/tests/import_test.php | 2 +- mod/data/tests/lib_test.php | 2 +- mod/data/tests/privacy_provider_test.php | 2 +- mod/data/tests/search_test.php | 2 +- mod/feedback/tests/events_test.php | 2 +- mod/feedback/tests/external_test.php | 2 +- mod/feedback/tests/privacy_test.php | 2 +- mod/folder/tests/events_test.php | 2 +- mod/folder/tests/lib_test.php | 4 ++-- mod/folder/tests/search_test.php | 2 +- mod/forum/tests/builders_exported_posts_test.php | 4 ++-- mod/forum/tests/events_test.php | 4 ++-- mod/forum/tests/exporters_discussion_test.php | 4 ++-- mod/forum/tests/externallib_test.php | 4 ++-- mod/forum/tests/generator_test.php | 4 ++-- mod/forum/tests/lib_test.php | 4 ++-- mod/forum/tests/mail_group_test.php | 4 ++-- mod/forum/tests/mail_test.php | 4 ++-- mod/forum/tests/maildigest_test.php | 4 ++-- mod/forum/tests/managers_capability_test.php | 4 ++-- mod/forum/tests/privacy_provider_test.php | 2 +- mod/forum/tests/private_replies_test.php | 4 ++-- mod/forum/tests/qanda_test.php | 4 ++-- mod/forum/tests/search_test.php | 2 +- mod/forum/tests/subscriptions_test.php | 4 ++-- mod/forum/tests/vaults_discussion_list_test.php | 2 +- mod/forum/tests/vaults_discussion_test.php | 2 +- mod/forum/tests/vaults_post_test.php | 4 ++-- mod/glossary/tests/events_test.php | 2 +- mod/glossary/tests/privacy_provider_test.php | 2 +- mod/glossary/tests/search_test.php | 2 +- mod/label/tests/lib_test.php | 4 ++-- mod/lesson/tests/events_test.php | 2 +- mod/lesson/tests/external_test.php | 2 +- mod/lesson/tests/privacy_test.php | 2 +- .../gradebookservices/tests/privacy_provider_test.php | 2 +- .../service/gradebookservices/tests/task_cleanup_test.php | 2 +- .../service/memberships/tests/privacy_provider_test.php | 2 +- mod/lti/tests/externallib_test.php | 2 +- mod/lti/tests/lib_test.php | 2 +- mod/lti/tests/task_clean_access_tokens_test.php | 2 +- mod/page/tests/lib_test.php | 2 +- mod/quiz/accessrule/seb/tests/access_manager_test.php | 2 +- mod/quiz/accessrule/seb/tests/backup_restore_test.php | 2 +- mod/quiz/accessrule/seb/tests/event_test.php | 4 ++-- mod/quiz/accessrule/seb/tests/link_generator_test.php | 2 +- mod/quiz/accessrule/seb/tests/quiz_settings_test.php | 2 +- mod/quiz/accessrule/seb/tests/rule_test.php | 4 ++-- mod/quiz/accessrule/seb/tests/template_test.php | 2 +- mod/quiz/tests/external_test.php | 2 +- mod/quiz/tests/repaginate_test.php | 4 ++-- mod/resource/tests/events_test.php | 2 +- mod/resource/tests/lib_test.php | 2 +- mod/resource/tests/search_test.php | 2 +- mod/scorm/report/basic/tests/privacy_test.php | 2 +- mod/scorm/report/interactions/tests/privacy_test.php | 2 +- mod/scorm/report/objectives/tests/privacy_test.php | 2 +- mod/scorm/tests/events_test.php | 2 +- mod/scorm/tests/externallib_test.php | 2 +- mod/scorm/tests/lib_test.php | 2 +- mod/scorm/tests/locallib_test.php | 2 +- mod/survey/tests/events_test.php | 2 +- mod/survey/tests/externallib_test.php | 2 +- mod/survey/tests/lib_test.php | 2 +- mod/survey/tests/privacy_test.php | 2 +- mod/url/tests/lib_test.php | 4 ++-- mod/wiki/tests/events_test.php | 2 +- mod/wiki/tests/externallib_test.php | 2 +- mod/wiki/tests/privacy_test.php | 2 +- mod/wiki/tests/search_test.php | 2 +- mod/workshop/allocation/random/tests/allocator_test.php | 4 ++-- mod/workshop/eval/best/tests/lib_test.php | 4 ++-- mod/workshop/form/accumulative/tests/lib_test.php | 4 ++-- mod/workshop/form/numerrors/tests/lib_test.php | 4 ++-- mod/workshop/form/rubric/tests/lib_test.php | 4 ++-- mod/workshop/tests/events_test.php | 4 ++-- mod/workshop/tests/external_test.php | 2 +- mod/workshop/tests/locallib_test.php | 4 ++-- mod/workshop/tests/portfolio_caller_test.php | 4 ++-- mod/workshop/tests/privacy_provider_test.php | 2 +- my/tests/events_test.php | 2 +- notes/tests/events_test.php | 2 +- notes/tests/lib_test.php | 4 ++-- privacy/classes/tests/provider_testcase.php | 2 +- privacy/tests/manager_test.php | 2 +- privacy/tests/writer_test.php | 2 +- question/behaviour/adaptive/tests/behaviourtype_test.php | 2 +- question/behaviour/adaptive/tests/mark_display_test.php | 2 +- .../behaviour/deferredcbm/tests/behaviourtype_test.php | 2 +- .../deferredfeedback/tests/behaviourtype_test.php | 2 +- .../behaviour/immediatecbm/tests/behaviourtype_test.php | 2 +- .../immediatefeedback/tests/behaviourtype_test.php | 2 +- .../informationitem/tests/behaviourtype_test.php | 2 +- .../behaviour/interactive/tests/behaviourtype_test.php | 2 +- .../interactivecountback/tests/behaviourtype_test.php | 2 +- .../behaviour/manualgraded/tests/behaviourtype_test.php | 2 +- question/behaviour/missing/tests/behaviourtype_test.php | 2 +- question/engine/tests/helpers.php | 4 ++-- question/engine/tests/questionattempt_test.php | 4 ++-- question/engine/tests/questionattempt_with_steps_test.php | 4 ++-- question/engine/tests/questionattemptiterator_test.php | 6 +++--- .../engine/tests/questionattemptstepiterator_test.php | 6 +++--- question/engine/tests/questionusage_autosave_test.php | 2 +- question/engine/tests/unitofwork_test.php | 4 ++-- question/engine/upgrade/tests/helper.php | 4 ++-- question/tests/category_class_test.php | 2 +- question/tests/events_test.php | 2 +- question/tests/externallib_test.php | 2 +- question/type/calculated/tests/questiontype_test.php | 4 ++-- .../type/calculatedsimple/tests/questiontype_test.php | 4 ++-- question/type/ddimageortext/tests/questiontype_test.php | 4 ++-- question/type/ddmarker/tests/questiontype_test.php | 4 ++-- question/type/ddwtos/tests/questiontype_test.php | 4 ++-- question/type/description/tests/questiontype_test.php | 4 ++-- question/type/essay/tests/questiontype_test.php | 4 ++-- question/type/gapselect/tests/questiontype_test.php | 4 ++-- question/type/match/tests/questiontype_test.php | 4 ++-- question/type/multianswer/tests/questiontype_test.php | 4 ++-- question/type/multichoice/tests/questiontype_test.php | 4 ++-- question/type/numerical/tests/questiontype_test.php | 4 ++-- question/type/random/tests/questiontype_test.php | 4 ++-- question/type/shortanswer/tests/questiontype_test.php | 4 ++-- ...estion_first_matching_answer_grading_strategy_test.php | 4 ++-- question/type/truefalse/tests/questiontype_test.php | 4 ++-- rating/tests/externallib_test.php | 2 +- rating/tests/rating_test.php | 2 +- report/completion/tests/events_test.php | 2 +- report/log/tests/events_test.php | 2 +- report/log/tests/lib_test.php | 2 +- report/loglive/tests/events_test.php | 2 +- report/outline/tests/lib_test.php | 2 +- report/questioninstances/tests/events_test.php | 2 +- report/stats/tests/events_test.php | 2 +- report/stats/tests/lib_test.php | 2 +- report/usersessions/tests/lib_test.php | 2 +- repository/flickr/tests/privacy_test.php | 2 +- .../tests/access_controlled_link_manager_test.php | 4 ++-- repository/nextcloud/tests/lib_test.php | 2 +- repository/nextcloud/tests/ocs_test.php | 2 +- repository/onedrive/tests/privacy_test.php | 2 +- repository/recent/tests/lib_test.php | 2 +- repository/tests/privacy_test.php | 2 +- rss/tests/privacy_test.php | 2 +- search/engine/simpledb/tests/engine_test.php | 4 ++-- search/engine/simpledb/tests/privacy_test.php | 4 ++-- search/engine/solr/tests/engine_test.php | 4 ++-- search/tests/base_activity_test.php | 4 ++-- search/tests/base_test.php | 4 ++-- search/tests/document_test.php | 4 ++-- search/tests/engine_test.php | 2 +- search/tests/external_test.php | 2 +- search/tests/generator/lib.php | 4 ++-- search/tests/manager_test.php | 4 ++-- tag/tests/events_test.php | 2 +- tag/tests/taglib_test.php | 2 +- user/profile/field/checkbox/tests/privacy_test.php | 2 +- user/profile/field/datetime/tests/privacy_test.php | 2 +- user/profile/field/menu/tests/privacy_test.php | 2 +- user/profile/field/text/tests/privacy_test.php | 2 +- user/profile/field/textarea/tests/privacy_test.php | 2 +- user/tests/search_test.php | 2 +- webservice/tests/events_test.php | 2 +- webservice/tests/externallib_test.php | 2 +- webservice/tests/lib_test.php | 2 +- webservice/tests/privacy_test.php | 2 +- webservice/xmlrpc/tests/lib_test.php | 2 +- webservice/xmlrpc/tests/locallib_test.php | 2 +- webservice/xmlrpc/tests/xmlrpc_server_test.php | 2 +- 421 files changed, 531 insertions(+), 531 deletions(-) diff --git a/admin/tool/behat/tests/manager_util_test.php b/admin/tool/behat/tests/manager_util_test.php index 98ccd03a85a..71629550155 100644 --- a/admin/tool/behat/tests/manager_util_test.php +++ b/admin/tool/behat/tests/manager_util_test.php @@ -87,7 +87,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase { /** * Setup test. */ - public function setup() { + public function setUp(): void { global $CFG; $this->resetAfterTest(); diff --git a/admin/tool/capability/tests/events_test.php b/admin/tool/capability/tests/events_test.php index 30942ca4b3d..1e3e8d5bc26 100644 --- a/admin/tool/capability/tests/events_test.php +++ b/admin/tool/capability/tests/events_test.php @@ -36,7 +36,7 @@ class tool_capability_events_testcase extends advanced_testcase { /** * Setup testcase. */ - public function setUp() { + public function setUp(): void { $this->setAdminUser(); $this->resetAfterTest(); } diff --git a/admin/tool/cohortroles/tests/api_test.php b/admin/tool/cohortroles/tests/api_test.php index 2d99e5c37ac..f023b71840b 100644 --- a/admin/tool/cohortroles/tests/api_test.php +++ b/admin/tool/cohortroles/tests/api_test.php @@ -49,7 +49,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase { /** * Setup function- we will create a course and add an assign instance to it. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(true); // Create some users. diff --git a/admin/tool/cohortroles/tests/privacy_test.php b/admin/tool/cohortroles/tests/privacy_test.php index 6399314cf77..72446a2e834 100644 --- a/admin/tool/cohortroles/tests/privacy_test.php +++ b/admin/tool/cohortroles/tests/privacy_test.php @@ -43,7 +43,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes /** * Overriding setUp() function to always reset after tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/admin/tool/dataprivacy/tests/expired_data_requests_test.php b/admin/tool/dataprivacy/tests/expired_data_requests_test.php index eec0bd5397c..32c4f56afa5 100644 --- a/admin/tool/dataprivacy/tests/expired_data_requests_test.php +++ b/admin/tool/dataprivacy/tests/expired_data_requests_test.php @@ -44,7 +44,7 @@ class tool_dataprivacy_expired_data_requests_testcase extends data_privacy_testc /** * Test tearDown. */ - public function tearDown() { + public function tearDown(): void { \core_privacy\local\request\writer::reset(); } diff --git a/admin/tool/dataprivacy/tests/task_test.php b/admin/tool/dataprivacy/tests/task_test.php index 0dc614a43a0..8ab89199632 100644 --- a/admin/tool/dataprivacy/tests/task_test.php +++ b/admin/tool/dataprivacy/tests/task_test.php @@ -39,7 +39,7 @@ class tool_dataprivacy_task_testcase extends data_privacy_testcase { /** * Test tearDown. */ - public function tearDown() { + public function tearDown(): void { \core_privacy\local\request\writer::reset(); } diff --git a/admin/tool/langimport/tests/events_test.php b/admin/tool/langimport/tests/events_test.php index d2164cf443c..0633984a8fb 100644 --- a/admin/tool/langimport/tests/events_test.php +++ b/admin/tool/langimport/tests/events_test.php @@ -36,7 +36,7 @@ class tool_langimport_events_testcase extends advanced_testcase { /** * Setup testcase. */ - public function setUp() { + public function setUp(): void { $this->setAdminUser(); $this->resetAfterTest(); } diff --git a/admin/tool/log/store/database/tests/privacy_test.php b/admin/tool/log/store/database/tests/privacy_test.php index 085ce1b27f1..86b8b37790d 100644 --- a/admin/tool/log/store/database/tests/privacy_test.php +++ b/admin/tool/log/store/database/tests/privacy_test.php @@ -50,7 +50,7 @@ require_once(__DIR__ . '/fixtures/event.php'); */ class logstore_database_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { global $CFG; $this->resetAfterTest(); $this->preventResetByRollback(); // Logging waits till the transaction gets committed. diff --git a/admin/tool/log/store/legacy/tests/privacy_test.php b/admin/tool/log/store/legacy/tests/privacy_test.php index d6d2a6c63d9..ad0e9920eab 100644 --- a/admin/tool/log/store/legacy/tests/privacy_test.php +++ b/admin/tool/log/store/legacy/tests/privacy_test.php @@ -48,7 +48,7 @@ require_once(__DIR__ . '/fixtures/event.php'); */ class logstore_legacy_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/admin/tool/log/store/standard/tests/privacy_test.php b/admin/tool/log/store/standard/tests/privacy_test.php index 1e23599a30c..d324d79b139 100644 --- a/admin/tool/log/store/standard/tests/privacy_test.php +++ b/admin/tool/log/store/standard/tests/privacy_test.php @@ -47,7 +47,7 @@ require_once(__DIR__ . '/fixtures/event.php'); */ class logstore_standard_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->preventResetByRollback(); // Logging waits till the transaction gets committed. } diff --git a/admin/tool/log/store/standard/tests/store_test.php b/admin/tool/log/store/standard/tests/store_test.php index 1492718b0fb..aeb15c6b61e 100644 --- a/admin/tool/log/store/standard/tests/store_test.php +++ b/admin/tool/log/store/standard/tests/store_test.php @@ -540,7 +540,7 @@ class logstore_standard_store_testcase extends advanced_testcase { /** * Reset any garbage collector changes to the previous state at the end of the test. */ - public function tearDown() { + public function tearDown(): void { if ($this->wedisabledgc) { gc_enable(); } diff --git a/admin/tool/log/tests/privacy_test.php b/admin/tool/log/tests/privacy_test.php index ae85b869a65..f69738759b6 100644 --- a/admin/tool/log/tests/privacy_test.php +++ b/admin/tool/log/tests/privacy_test.php @@ -51,7 +51,7 @@ require_once($CFG->dirroot . '/admin/tool/log/store/standard/tests/fixtures/even */ class tool_log_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->preventResetByRollback(); // Logging waits till the transaction gets committed. } diff --git a/admin/tool/lp/tests/externallib_test.php b/admin/tool/lp/tests/externallib_test.php index 8511c842f2b..338bdebdcb6 100644 --- a/admin/tool/lp/tests/externallib_test.php +++ b/admin/tool/lp/tests/externallib_test.php @@ -75,7 +75,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase { /** * Setup function- we will create a course and add an assign instance to it. */ - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; $this->resetAfterTest(true); diff --git a/admin/tool/lpmigrate/tests/processor_test.php b/admin/tool/lpmigrate/tests/processor_test.php index c8db5c18ac7..b1336725623 100644 --- a/admin/tool/lpmigrate/tests/processor_test.php +++ b/admin/tool/lpmigrate/tests/processor_test.php @@ -46,7 +46,7 @@ class tool_lpmigrate_framework_processor_testcase extends advanced_testcase { * Then we create 2 courses, and in each 1 CM. * Then we attach some competencies from the first framework to courses and CM. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); $dg = $this->getDataGenerator(); $lpg = $dg->get_plugin_generator('core_competency'); diff --git a/admin/tool/messageinbound/tests/manager_test.php b/admin/tool/messageinbound/tests/manager_test.php index b88a74261bf..0ba834c70dd 100644 --- a/admin/tool/messageinbound/tests/manager_test.php +++ b/admin/tool/messageinbound/tests/manager_test.php @@ -44,7 +44,7 @@ use tool_messageinbound\privacy\provider; */ class tool_messageinbound_manager_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { global $CFG; $this->resetAfterTest(); diff --git a/admin/tool/messageinbound/tests/privacy_test.php b/admin/tool/messageinbound/tests/privacy_test.php index e98c027a5b9..65d6869af7e 100644 --- a/admin/tool/messageinbound/tests/privacy_test.php +++ b/admin/tool/messageinbound/tests/privacy_test.php @@ -46,7 +46,7 @@ use tool_messageinbound\privacy\provider; */ class tool_messageinbound_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { global $CFG; $this->resetAfterTest(); diff --git a/admin/tool/mobile/tests/privacy_provider_test.php b/admin/tool/mobile/tests/privacy_provider_test.php index 6e1da9c8e07..c1469f457e3 100644 --- a/admin/tool/mobile/tests/privacy_provider_test.php +++ b/admin/tool/mobile/tests/privacy_provider_test.php @@ -40,7 +40,7 @@ class tool_mobile_privacy_testcase extends \core_privacy\tests\provider_testcase /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/admin/tool/monitor/tests/eventobservers_test.php b/admin/tool/monitor/tests/eventobservers_test.php index f74c10b309c..35a90b44941 100644 --- a/admin/tool/monitor/tests/eventobservers_test.php +++ b/admin/tool/monitor/tests/eventobservers_test.php @@ -38,7 +38,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase { /** * Set up method. */ - public function setUp() { + public function setUp(): void { // Enable monitor. set_config('enablemonitor', 1, 'tool_monitor'); } diff --git a/admin/tool/monitor/tests/events_test.php b/admin/tool/monitor/tests/events_test.php index 4ed829d3f40..109bc7ff92b 100644 --- a/admin/tool/monitor/tests/events_test.php +++ b/admin/tool/monitor/tests/events_test.php @@ -33,7 +33,7 @@ class tool_monitor_events_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { set_config('enablemonitor', 1, 'tool_monitor'); $this->resetAfterTest(); } diff --git a/admin/tool/monitor/tests/generator_test.php b/admin/tool/monitor/tests/generator_test.php index 7c4ae86587d..c2672a8c67f 100644 --- a/admin/tool/monitor/tests/generator_test.php +++ b/admin/tool/monitor/tests/generator_test.php @@ -39,7 +39,7 @@ class tool_monitor_generator_testcase extends advanced_testcase { /** * Set up method. */ - public function setUp() { + public function setUp(): void { // Enable monitor. set_config('enablemonitor', 1, 'tool_monitor'); } @@ -138,4 +138,4 @@ class tool_monitor_generator_testcase extends advanced_testcase { $this->assertEquals(1, $historydata->userid); $this->assertEquals(1, $historydata->sid); } -} \ No newline at end of file +} diff --git a/admin/tool/monitor/tests/privacy_test.php b/admin/tool/monitor/tests/privacy_test.php index 3d419c7e4d5..871b11d5130 100644 --- a/admin/tool/monitor/tests/privacy_test.php +++ b/admin/tool/monitor/tests/privacy_test.php @@ -43,7 +43,7 @@ class tool_monitor_privacy_testcase extends provider_testcase { /** * Set up method. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); // Enable monitor. set_config('enablemonitor', 1, 'tool_monitor'); diff --git a/admin/tool/monitor/tests/rule_manager_test.php b/admin/tool/monitor/tests/rule_manager_test.php index a5173faad34..fd334e61e50 100644 --- a/admin/tool/monitor/tests/rule_manager_test.php +++ b/admin/tool/monitor/tests/rule_manager_test.php @@ -37,7 +37,7 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase { /** * Set up method. */ - public function setUp() { + public function setUp(): void { // Enable monitor. set_config('enablemonitor', 1, 'tool_monitor'); } @@ -192,4 +192,4 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase { $this->assertEmpty(array_diff(array_keys($ruledata), $ruleids)); $this->assertCount(10, $ruledata); } -} \ No newline at end of file +} diff --git a/admin/tool/monitor/tests/subscription_test.php b/admin/tool/monitor/tests/subscription_test.php index b3511b5e846..cb18815ad12 100644 --- a/admin/tool/monitor/tests/subscription_test.php +++ b/admin/tool/monitor/tests/subscription_test.php @@ -34,7 +34,7 @@ class tool_monitor_subscription_testcase extends advanced_testcase { /** * Test set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); // Create the mock subscription. diff --git a/admin/tool/monitor/tests/task_check_subscriptions_test.php b/admin/tool/monitor/tests/task_check_subscriptions_test.php index b52678436e6..10a5e98efa9 100644 --- a/admin/tool/monitor/tests/task_check_subscriptions_test.php +++ b/admin/tool/monitor/tests/task_check_subscriptions_test.php @@ -36,7 +36,7 @@ class tool_monitor_task_check_subscriptions_testcase extends advanced_testcase { /** * Test set up. */ - public function setUp() { + public function setUp(): void { global $DB; set_config('enablemonitor', 1, 'tool_monitor'); $this->resetAfterTest(true); diff --git a/admin/tool/monitor/tests/task_clean_events_test.php b/admin/tool/monitor/tests/task_clean_events_test.php index 9de32269c36..5f0a13ca58f 100644 --- a/admin/tool/monitor/tests/task_clean_events_test.php +++ b/admin/tool/monitor/tests/task_clean_events_test.php @@ -35,7 +35,7 @@ class tool_monitor_task_clean_events_testcase extends advanced_testcase { /** * Test set up. */ - public function setUp() { + public function setUp(): void { set_config('enablemonitor', 1, 'tool_monitor'); $this->resetAfterTest(true); } diff --git a/admin/tool/policy/tests/externallib_test.php b/admin/tool/policy/tests/externallib_test.php index 8abff00e520..bec7faab688 100644 --- a/admin/tool/policy/tests/externallib_test.php +++ b/admin/tool/policy/tests/externallib_test.php @@ -46,7 +46,7 @@ class tool_policy_external_testcase extends externallib_advanced_testcase { /** * Setup function- we will create some policy docs. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); $this->setAdminUser(); diff --git a/admin/tool/policy/tests/privacy_provider_test.php b/admin/tool/policy/tests/privacy_provider_test.php index c771cde1bdd..6fa4a0d6c11 100644 --- a/admin/tool/policy/tests/privacy_provider_test.php +++ b/admin/tool/policy/tests/privacy_provider_test.php @@ -51,7 +51,7 @@ class tool_policy_privacy_provider_testcase extends \core_privacy\tests\provider /** * Setup function. Will create a user. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); diff --git a/admin/tool/recyclebin/tests/category_bin_test.php b/admin/tool/recyclebin/tests/category_bin_test.php index 0e24c311ca1..199fca063c2 100644 --- a/admin/tool/recyclebin/tests/category_bin_test.php +++ b/admin/tool/recyclebin/tests/category_bin_test.php @@ -46,7 +46,7 @@ class tool_recyclebin_category_bin_tests extends advanced_testcase { /** * Setup for each test. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); diff --git a/admin/tool/recyclebin/tests/course_bin_test.php b/admin/tool/recyclebin/tests/course_bin_test.php index 44f9db6cc06..87c4e86db76 100644 --- a/admin/tool/recyclebin/tests/course_bin_test.php +++ b/admin/tool/recyclebin/tests/course_bin_test.php @@ -46,7 +46,7 @@ class tool_recyclebin_course_bin_tests extends advanced_testcase { /** * Setup for each test. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(true); $this->setAdminUser(); diff --git a/admin/tool/recyclebin/tests/events_test.php b/admin/tool/recyclebin/tests/events_test.php index c3ea0e68477..c7be87b264f 100644 --- a/admin/tool/recyclebin/tests/events_test.php +++ b/admin/tool/recyclebin/tests/events_test.php @@ -40,7 +40,7 @@ class tool_recyclebin_events_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); // We want the category and course bin to be enabled. diff --git a/admin/tool/usertours/tests/accessdate_filter_test.php b/admin/tool/usertours/tests/accessdate_filter_test.php index 642ee0c775a..b60247feacf 100644 --- a/admin/tool/usertours/tests/accessdate_filter_test.php +++ b/admin/tool/usertours/tests/accessdate_filter_test.php @@ -36,7 +36,7 @@ use tool_usertours\local\filter\accessdate; */ class tool_usertours_accessdate_filter_test extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/admin/tool/usertours/tests/manager_test.php b/admin/tool/usertours/tests/manager_test.php index d5e4893ccf5..0deff0da644 100644 --- a/admin/tool/usertours/tests/manager_test.php +++ b/admin/tool/usertours/tests/manager_test.php @@ -47,7 +47,7 @@ class tool_usertours_manager_testcase extends advanced_testcase { /** * Setup to store the DB reference. */ - public function setUp() { + public function setUp(): void { global $DB; $this->db = $DB; @@ -56,7 +56,7 @@ class tool_usertours_manager_testcase extends advanced_testcase { /** * Tear down to restore the original DB reference. */ - public function tearDown() { + public function tearDown(): void { global $DB; $DB = $this->db; diff --git a/admin/tool/usertours/tests/role_filter_test.php b/admin/tool/usertours/tests/role_filter_test.php index 940e517fc3e..8fe97394343 100644 --- a/admin/tool/usertours/tests/role_filter_test.php +++ b/admin/tool/usertours/tests/role_filter_test.php @@ -58,7 +58,7 @@ class tool_usertours_role_filter_testcase extends advanced_testcase { */ protected $roles; - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(true); diff --git a/admin/tool/usertours/tests/step_test.php b/admin/tool/usertours/tests/step_test.php index 005272ee081..fb6a3c1d85f 100644 --- a/admin/tool/usertours/tests/step_test.php +++ b/admin/tool/usertours/tests/step_test.php @@ -44,7 +44,7 @@ class step_testcase extends advanced_testcase { /** * Setup to store the DB reference. */ - public function setUp() { + public function setUp(): void { global $DB; $this->db = $DB; @@ -53,7 +53,7 @@ class step_testcase extends advanced_testcase { /** * Tear down to restore the original DB reference. */ - public function tearDown() { + public function tearDown(): void { global $DB; $DB = $this->db; diff --git a/admin/tool/usertours/tests/tour_test.php b/admin/tool/usertours/tests/tour_test.php index c5bf23f012a..d1014f7d847 100644 --- a/admin/tool/usertours/tests/tour_test.php +++ b/admin/tool/usertours/tests/tour_test.php @@ -46,7 +46,7 @@ class tour_testcase extends advanced_testcase { /** * Setup to store the DB reference. */ - public function setUp() { + public function setUp(): void { global $DB; $this->db = $DB; @@ -55,7 +55,7 @@ class tour_testcase extends advanced_testcase { /** * Tear down to restore the original DB reference. */ - public function tearDown() { + public function tearDown(): void { global $DB; $DB = $this->db; diff --git a/analytics/tests/course_test.php b/analytics/tests/course_test.php index 00cfea33691..13010f96645 100644 --- a/analytics/tests/course_test.php +++ b/analytics/tests/course_test.php @@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die(); */ class core_analytics_course_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { global $DB; $this->course = $this->getDataGenerator()->create_course(['startdate' => 0]); diff --git a/analytics/tests/dataset_manager_test.php b/analytics/tests/dataset_manager_test.php index f5c916c9ea3..fb600c8fb9a 100644 --- a/analytics/tests/dataset_manager_test.php +++ b/analytics/tests/dataset_manager_test.php @@ -38,7 +38,7 @@ class dataset_manager_testcase extends advanced_testcase { * * @return null */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); $this->sharedtoprows = array( diff --git a/analytics/tests/model_test.php b/analytics/tests/model_test.php index 9d5bdd2b1e9..a1004fb563f 100644 --- a/analytics/tests/model_test.php +++ b/analytics/tests/model_test.php @@ -41,7 +41,7 @@ require_once(__DIR__ . '/fixtures/test_analysis.php'); */ class analytics_model_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->setAdminUser(); diff --git a/analytics/tests/prediction_actions_test.php b/analytics/tests/prediction_actions_test.php index f3768788e0f..f8f2866dcb8 100644 --- a/analytics/tests/prediction_actions_test.php +++ b/analytics/tests/prediction_actions_test.php @@ -39,7 +39,7 @@ class analytics_prediction_actions_testcase extends advanced_testcase { /** * Common startup tasks */ - public function setUp() { + public function setUp(): void { global $DB; $this->setAdminUser(); diff --git a/analytics/tests/prediction_test.php b/analytics/tests/prediction_test.php index 1fd9ac2a724..159bfd83466 100644 --- a/analytics/tests/prediction_test.php +++ b/analytics/tests/prediction_test.php @@ -62,7 +62,7 @@ class core_analytics_prediction_testcase extends advanced_testcase { * * @return null */ - public function tearDown() { + public function tearDown(): void { $this->setAdminUser(); $models = \core_analytics\manager::get_all_models(); diff --git a/analytics/tests/privacy_test.php b/analytics/tests/privacy_test.php index 21fdd289757..d0fa280cda1 100644 --- a/analytics/tests/privacy_test.php +++ b/analytics/tests/privacy_test.php @@ -44,7 +44,7 @@ require_once(__DIR__ . '/fixtures/test_target_course_users.php'); */ class core_analytics_privacy_model_testcase extends \core_privacy\tests\provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); $this->setAdminUser(); diff --git a/analytics/tests/stats_test.php b/analytics/tests/stats_test.php index 5054a3fb040..5d3cb030251 100644 --- a/analytics/tests/stats_test.php +++ b/analytics/tests/stats_test.php @@ -39,7 +39,7 @@ class analytics_stats_testcase extends advanced_testcase { /** * Set up the test environment. */ - public function setUp() { + public function setUp(): void { $this->setAdminUser(); } diff --git a/auth/email/tests/external_test.php b/auth/email/tests/external_test.php index f62f95c1102..ed1900a6dfd 100644 --- a/auth/email/tests/external_test.php +++ b/auth/email/tests/external_test.php @@ -43,7 +43,7 @@ class auth_email_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $CFG, $DB; $this->resetAfterTest(true); diff --git a/auth/manual/tests/manual_test.php b/auth/manual/tests/manual_test.php index 156a997fe94..7857e34b17b 100644 --- a/auth/manual/tests/manual_test.php +++ b/auth/manual/tests/manual_test.php @@ -44,7 +44,7 @@ class auth_manual_testcase extends advanced_testcase { /** * Setup test data. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(true); $this->authplugin = new auth_plugin_manual(); set_config('expiration', '1', 'auth_manual'); diff --git a/auth/manual/tests/privacy_provider_test.php b/auth/manual/tests/privacy_provider_test.php index 55722915e47..af741c3ee65 100644 --- a/auth/manual/tests/privacy_provider_test.php +++ b/auth/manual/tests/privacy_provider_test.php @@ -45,7 +45,7 @@ class auth_manual_privacy_testcase extends \core_privacy\tests\provider_testcase /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); $this->authplugin = new auth_plugin_manual(); } diff --git a/auth/mnet/tests/privacy_provider_test.php b/auth/mnet/tests/privacy_provider_test.php index 7ecf9e6d8ad..b41db22fff8 100644 --- a/auth/mnet/tests/privacy_provider_test.php +++ b/auth/mnet/tests/privacy_provider_test.php @@ -43,7 +43,7 @@ class auth_mnet_privacy_testcase extends provider_testcase { /** * Set up method. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); } diff --git a/auth/oauth2/tests/privacy_provider_test.php b/auth/oauth2/tests/privacy_provider_test.php index d582d0a4dce..1e190cf3e0f 100644 --- a/auth/oauth2/tests/privacy_provider_test.php +++ b/auth/oauth2/tests/privacy_provider_test.php @@ -42,7 +42,7 @@ class auth_oauth2_privacy_testcase extends provider_testcase { /** * Set up method. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); } diff --git a/auth/tests/external_test.php b/auth/tests/external_test.php index 237852ce6e5..f3f53d5feb6 100644 --- a/auth/tests/external_test.php +++ b/auth/tests/external_test.php @@ -46,7 +46,7 @@ class core_auth_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $CFG; $this->resetAfterTest(true); @@ -60,7 +60,7 @@ class core_auth_external_testcase extends externallib_advanced_testcase { /** * Tear down to restore old logging.. */ - protected function tearDown() { + protected function tearDown(): void { ini_set('error_log', $this->oldlog); parent::tearDown(); } diff --git a/auth/tests/privacy_test.php b/auth/tests/privacy_test.php index 16701f26f80..d3586d3f1bc 100644 --- a/auth/tests/privacy_test.php +++ b/auth/tests/privacy_test.php @@ -43,7 +43,7 @@ use core_auth\privacy\provider; */ class core_auth_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/availability/condition/completion/tests/condition_test.php b/availability/condition/completion/tests/condition_test.php index b1a004093c6..02d8476b775 100644 --- a/availability/condition/completion/tests/condition_test.php +++ b/availability/condition/completion/tests/condition_test.php @@ -52,7 +52,7 @@ class availability_completion_condition_testcase extends advanced_testcase { /** * Load required classes. */ - public function setUp() { + public function setUp(): void { availability_completion\condition::wipe_static_cache(); } diff --git a/availability/condition/date/tests/condition_test.php b/availability/condition/date/tests/condition_test.php index 7b62904e210..ae2b2a7c244 100644 --- a/availability/condition/date/tests/condition_test.php +++ b/availability/condition/date/tests/condition_test.php @@ -38,7 +38,7 @@ class availability_date_condition_testcase extends advanced_testcase { /** * Load required classes. */ - public function setUp() { + public function setUp(): void { // Load the mock info class so that it can be used. global $CFG; require_once($CFG->dirroot . '/availability/tests/fixtures/mock_info.php'); diff --git a/availability/condition/group/tests/condition_test.php b/availability/condition/group/tests/condition_test.php index 1c94323a7c3..2f7d6184749 100644 --- a/availability/condition/group/tests/condition_test.php +++ b/availability/condition/group/tests/condition_test.php @@ -37,7 +37,7 @@ class availability_group_condition_testcase extends advanced_testcase { /** * Load required classes. */ - public function setUp() { + public function setUp(): void { // Load the mock info class so that it can be used. global $CFG; require_once($CFG->dirroot . '/availability/tests/fixtures/mock_info.php'); diff --git a/availability/condition/grouping/tests/condition_test.php b/availability/condition/grouping/tests/condition_test.php index 94cd4ec3301..5f5f7769dce 100644 --- a/availability/condition/grouping/tests/condition_test.php +++ b/availability/condition/grouping/tests/condition_test.php @@ -37,7 +37,7 @@ class availability_grouping_condition_testcase extends advanced_testcase { /** * Load required classes. */ - public function setUp() { + public function setUp(): void { // Load the mock info class so that it can be used. global $CFG; require_once($CFG->dirroot . '/availability/tests/fixtures/mock_info.php'); diff --git a/availability/condition/profile/tests/condition_test.php b/availability/condition/profile/tests/condition_test.php index e2250e22d06..c6dc98dda3a 100644 --- a/availability/condition/profile/tests/condition_test.php +++ b/availability/condition/profile/tests/condition_test.php @@ -45,7 +45,7 @@ class availability_profile_condition_testcase extends advanced_testcase { /** @var \core_availability\info Current info */ private $info; - public function setUp() { + public function setUp(): void { global $DB, $CFG; $this->resetAfterTest(); diff --git a/availability/tests/info_test.php b/availability/tests/info_test.php index e8044df1380..befd3fff4c0 100644 --- a/availability/tests/info_test.php +++ b/availability/tests/info_test.php @@ -36,7 +36,7 @@ use core_availability\info_section; * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class info_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { // Load the mock condition so that it can be used. require_once(__DIR__ . '/fixtures/mock_condition.php'); } diff --git a/availability/tests/tree_test.php b/availability/tests/tree_test.php index 1b131a9a96e..2760c5896d6 100644 --- a/availability/tests/tree_test.php +++ b/availability/tests/tree_test.php @@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class tree_testcase extends \advanced_testcase { - public function setUp() { + public function setUp(): void { // Load the mock classes so they can be used. require_once(__DIR__ . '/fixtures/mock_condition.php'); require_once(__DIR__ . '/fixtures/mock_info.php'); diff --git a/backup/controller/tests/controller_test.php b/backup/controller/tests/controller_test.php index f638be031aa..5c93fb60e21 100644 --- a/backup/controller/tests/controller_test.php +++ b/backup/controller/tests/controller_test.php @@ -38,7 +38,7 @@ class core_backup_controller_testcase extends advanced_testcase { protected $courseid; // course id used for testing protected $userid; // user used if for testing - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; $this->resetAfterTest(true); diff --git a/backup/converter/moodle1/tests/moodle1_converter_test.php b/backup/converter/moodle1/tests/moodle1_converter_test.php index 68589da2692..7065286efdb 100644 --- a/backup/converter/moodle1/tests/moodle1_converter_test.php +++ b/backup/converter/moodle1/tests/moodle1_converter_test.php @@ -41,7 +41,7 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase { /** @var string saved hash of an icon file used during testing */ protected $iconhash; - protected function setUp() { + protected function setUp(): void { global $CFG; $this->tempdir = convert_helper::generate_id('unittest'); @@ -75,7 +75,7 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase { ); } - protected function tearDown() { + protected function tearDown(): void { global $CFG; if (empty($CFG->keeptempdirectoriesonbackup)) { fulldelete($this->tempdirpath); diff --git a/backup/moodle2/tests/backup_encrypted_content_test.php b/backup/moodle2/tests/backup_encrypted_content_test.php index 5a609c85d03..d8397e06a35 100644 --- a/backup/moodle2/tests/backup_encrypted_content_test.php +++ b/backup/moodle2/tests/backup_encrypted_content_test.php @@ -31,7 +31,7 @@ require_once($CFG->dirroot . '/backup/moodle2/backup_custom_fields.php'); class core_backup_encrypted_content_testscase extends advanced_testcase { - public function setUp() { + public function setUp(): void { if (!function_exists('openssl_encrypt')) { $this->markTestSkipped('OpenSSL extension is not loaded.'); diff --git a/backup/moodle2/tests/backup_xml_transformer_test.php b/backup/moodle2/tests/backup_xml_transformer_test.php index 554aa0be8fb..658f6c1bd4d 100644 --- a/backup/moodle2/tests/backup_xml_transformer_test.php +++ b/backup/moodle2/tests/backup_xml_transformer_test.php @@ -42,7 +42,7 @@ class backup_xml_transformer_testcase extends advanced_testcase { /** * Initial set up. */ - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(true); diff --git a/backup/tests/automated_backup_test.php b/backup/tests/automated_backup_test.php index 9ac514f97dc..c76d9529f3d 100644 --- a/backup/tests/automated_backup_test.php +++ b/backup/tests/automated_backup_test.php @@ -46,7 +46,7 @@ class core_backup_automated_backup_testcase extends advanced_testcase { */ protected $course; - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; $this->resetAfterTest(true); diff --git a/backup/tests/course_copy_test.php b/backup/tests/course_copy_test.php index 906dbfe51c4..40f216853e9 100644 --- a/backup/tests/course_copy_test.php +++ b/backup/tests/course_copy_test.php @@ -66,7 +66,7 @@ class core_backup_course_copy_testcase extends advanced_testcase { /** * Set up tasks for all tests. */ - protected function setUp() { + protected function setUp(): void { global $DB, $CFG, $USER; $this->resetAfterTest(true); @@ -633,4 +633,4 @@ class core_backup_course_copy_testcase extends advanced_testcase { $this->expectException(\moodle_exception::class); new \core_backup\copy\copy($formdata); } -} \ No newline at end of file +} diff --git a/backup/tests/externallib_test.php b/backup/tests/externallib_test.php index 8cb6e4d3a6a..df2b1539c4e 100644 --- a/backup/tests/externallib_test.php +++ b/backup/tests/externallib_test.php @@ -44,7 +44,7 @@ class backup_external_testcase extends externallib_advanced_testcase { /** * Set up tasks for all tests. */ - protected function setUp() { + protected function setUp(): void { global $CFG; $this->resetAfterTest(true); @@ -179,4 +179,4 @@ class backup_external_testcase extends externallib_advanced_testcase { $this->assertEquals(0, $restorerec->progress); $this->assertEquals('restore', $restorerec->operation); } -} \ No newline at end of file +} diff --git a/backup/util/checks/tests/checks_test.php b/backup/util/checks/tests/checks_test.php index 8e4ced3e7e3..3b8904358a1 100644 --- a/backup/util/checks/tests/checks_test.php +++ b/backup/util/checks/tests/checks_test.php @@ -39,7 +39,7 @@ class backup_check_testcase extends advanced_testcase { protected $courseid; // course id used for testing protected $userid; // user record id - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; parent::setUp(); diff --git a/backup/util/dbops/tests/backup_dbops_test.php b/backup/util/dbops/tests/backup_dbops_test.php index 219b5304653..7a18eb0fae4 100644 --- a/backup/util/dbops/tests/backup_dbops_test.php +++ b/backup/util/dbops/tests/backup_dbops_test.php @@ -37,7 +37,7 @@ class backup_dbops_testcase extends advanced_testcase { protected $courseid; // course id used for testing protected $userid; // user record used for testing - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; parent::setUp(); diff --git a/backup/util/factories/tests/factories_test.php b/backup/util/factories/tests/factories_test.php index 2a3fa1a55eb..7cebfc56c56 100644 --- a/backup/util/factories/tests/factories_test.php +++ b/backup/util/factories/tests/factories_test.php @@ -40,7 +40,7 @@ require_once($CFG->dirroot . '/backup/util/factories/backup_factory.class.php'); */ class backup_factories_testcase extends advanced_testcase { - function setUp() { + public function setUp(): void { global $CFG; parent::setUp(); @@ -57,7 +57,7 @@ class backup_factories_testcase extends advanced_testcase { /** * test get_logger_chain() method */ - function test_backup_factory() { + public function test_backup_factory() { global $CFG; // Default instantiate, all levels = backup::LOG_NONE 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 ea5ab2cc0e2..a5239a10c3e 100644 --- a/backup/util/helper/tests/restore_structure_parser_processor_test.php +++ b/backup/util/helper/tests/restore_structure_parser_processor_test.php @@ -42,7 +42,7 @@ class restore_structure_parser_processor_test extends advanced_testcase { /** * Initial set up. */ - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(true); diff --git a/backup/util/plan/tests/plan_test.php b/backup/util/plan/tests/plan_test.php index 3e9b2feb1f7..a02573689b7 100644 --- a/backup/util/plan/tests/plan_test.php +++ b/backup/util/plan/tests/plan_test.php @@ -36,7 +36,7 @@ class backup_plan_testcase extends advanced_testcase { protected $courseid; // course id used for testing protected $userid; // user record used for testing - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; parent::setUp(); diff --git a/backup/util/plan/tests/step_test.php b/backup/util/plan/tests/step_test.php index 8b9f6e17997..78d1a0c1804 100644 --- a/backup/util/plan/tests/step_test.php +++ b/backup/util/plan/tests/step_test.php @@ -36,7 +36,7 @@ class backup_step_testcase extends advanced_testcase { protected $courseid; // course id used for testing protected $userid; // user record used for testing - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; parent::setUp(); diff --git a/backup/util/plan/tests/task_test.php b/backup/util/plan/tests/task_test.php index 40ee6ead97c..3cb0bef732f 100644 --- a/backup/util/plan/tests/task_test.php +++ b/backup/util/plan/tests/task_test.php @@ -36,7 +36,7 @@ class backup_task_testcase extends advanced_testcase { protected $courseid; // course id used for testing protected $userid; // user record used for testing - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; parent::setUp(); diff --git a/backup/util/structure/tests/structure_test.php b/backup/util/structure/tests/structure_test.php index 93a51a7c627..3b9b807bcea 100644 --- a/backup/util/structure/tests/structure_test.php +++ b/backup/util/structure/tests/structure_test.php @@ -53,7 +53,7 @@ class backup_structure_testcase extends advanced_testcase { protected $contextid; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(true); diff --git a/badges/tests/badgeslib_test.php b/badges/tests/badgeslib_test.php index c4ec0e1acf6..0dac8de0348 100644 --- a/badges/tests/badgeslib_test.php +++ b/badges/tests/badgeslib_test.php @@ -43,7 +43,7 @@ class core_badges_badgeslib_testcase extends advanced_testcase { /** @var $assertion2 to define json format for Open badge version 2 */ protected $assertion2; - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; $this->resetAfterTest(true); $CFG->enablecompletion = true; diff --git a/badges/tests/external_test.php b/badges/tests/external_test.php index 0be15261f09..7b36cae7a57 100644 --- a/badges/tests/external_test.php +++ b/badges/tests/external_test.php @@ -45,7 +45,7 @@ class core_badges_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/badges/tests/privacy_test.php b/badges/tests/privacy_test.php index 8067b4ef1a5..12b8638c5ee 100644 --- a/badges/tests/privacy_test.php +++ b/badges/tests/privacy_test.php @@ -48,7 +48,7 @@ require_once($CFG->libdir . '/badgeslib.php'); */ class core_badges_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/blocks/comments/tests/events_test.php b/blocks/comments/tests/events_test.php index 1e7aae4b731..55db08c694f 100644 --- a/blocks/comments/tests/events_test.php +++ b/blocks/comments/tests/events_test.php @@ -43,7 +43,7 @@ class block_comments_events_testcase extends advanced_testcase { /** * Setup test data. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); diff --git a/blocks/comments/tests/privacy_provider_test.php b/blocks/comments/tests/privacy_provider_test.php index 363245d999b..1962cc13d6d 100644 --- a/blocks/comments/tests/privacy_provider_test.php +++ b/blocks/comments/tests/privacy_provider_test.php @@ -51,7 +51,7 @@ class block_comments_privacy_provider_testcase extends \core_privacy\tests\provi /** @var stdClass A test course. */ protected $course2; - protected function setUp() { + protected function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/blocks/online_users/tests/online_users_test.php b/blocks/online_users/tests/online_users_test.php index da436ac5a4a..9f56f5fc81d 100644 --- a/blocks/online_users/tests/online_users_test.php +++ b/blocks/online_users/tests/online_users_test.php @@ -47,7 +47,7 @@ class block_online_users_testcase extends advanced_testcase { * Prepare the site with some courses, groups, users and * simulate various recent accesses. */ - protected function setUp() { + protected function setUp(): void { // Generate (simulated) recently logged-in users. $generator = $this->getDataGenerator()->get_plugin_generator('block_online_users'); diff --git a/blocks/recentlyaccesseditems/tests/observer_test.php b/blocks/recentlyaccesseditems/tests/observer_test.php index fcc0eb25c56..6600709b20c 100644 --- a/blocks/recentlyaccesseditems/tests/observer_test.php +++ b/blocks/recentlyaccesseditems/tests/observer_test.php @@ -42,7 +42,7 @@ class block_recentlyaccesseditems_observer_testcase extends advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); @@ -157,4 +157,4 @@ class block_recentlyaccesseditems_observer_testcase extends advanced_testcase { $records = $DB->count_records($this->table, array('cmid' => $this->chat->cmid)); $this->assertEquals(2, $records); } -} \ No newline at end of file +} diff --git a/blocks/rss_client/tests/privacy_test.php b/blocks/rss_client/tests/privacy_test.php index 68035eface7..b3e9c1b739f 100644 --- a/blocks/rss_client/tests/privacy_test.php +++ b/blocks/rss_client/tests/privacy_test.php @@ -38,7 +38,7 @@ class block_rss_client_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/blocks/tests/privacy_test.php b/blocks/tests/privacy_test.php index 20df9d9fecb..4695a70d17c 100644 --- a/blocks/tests/privacy_test.php +++ b/blocks/tests/privacy_test.php @@ -44,7 +44,7 @@ use core_block\privacy\provider; */ class core_block_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/blog/tests/events_test.php b/blog/tests/events_test.php index 87f265dfeb3..e6105c8e3eb 100644 --- a/blog/tests/events_test.php +++ b/blog/tests/events_test.php @@ -58,7 +58,7 @@ class core_blog_events_testcase extends advanced_testcase { /** * Setup the tests. */ - protected function setUp() { + protected function setUp(): void { global $DB; parent::setUp(); diff --git a/blog/tests/external_test.php b/blog/tests/external_test.php index 5e23d5f827c..7887a693954 100644 --- a/blog/tests/external_test.php +++ b/blog/tests/external_test.php @@ -44,7 +44,7 @@ class core_blog_external_testcase extends advanced_testcase { private $tagid; private $postid; - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; parent::setUp(); diff --git a/blog/tests/lib_test.php b/blog/tests/lib_test.php index a690e6346a3..f1ad9219186 100644 --- a/blog/tests/lib_test.php +++ b/blog/tests/lib_test.php @@ -41,7 +41,7 @@ class core_blog_lib_testcase extends advanced_testcase { private $tagid; private $postid; - protected function setUp() { + protected function setUp(): void { global $DB; parent::setUp(); diff --git a/blog/tests/privacy_test.php b/blog/tests/privacy_test.php index 700255291da..67de624c045 100644 --- a/blog/tests/privacy_test.php +++ b/blog/tests/privacy_test.php @@ -47,7 +47,7 @@ require_once($CFG->dirroot . '/comment/lib.php'); */ class core_blog_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/cache/stores/apcu/tests/apcu_test.php b/cache/stores/apcu/tests/apcu_test.php index 4903d3bbb3d..108015b68e9 100644 --- a/cache/stores/apcu/tests/apcu_test.php +++ b/cache/stores/apcu/tests/apcu_test.php @@ -45,11 +45,11 @@ class cachestore_apcu_test extends cachestore_tests { return 'cachestore_apcu'; } - public function setUp() { + public function setUp(): void { if (!cachestore_apcu::are_requirements_met()) { $this->markTestSkipped('Could not test cachestore_apcu. Requirements are not met.'); } - return parent::setUp(); + parent::setUp(); } /** @@ -88,4 +88,4 @@ class cachestore_apcu_test extends cachestore_tests { $instance2->purge(); $this->assertSame(1, $instance->get('test1')); } -} \ No newline at end of file +} diff --git a/cache/stores/redis/tests/compressor_test.php b/cache/stores/redis/tests/compressor_test.php index 7f8876e301e..b7178b3c336 100644 --- a/cache/stores/redis/tests/compressor_test.php +++ b/cache/stores/redis/tests/compressor_test.php @@ -45,7 +45,7 @@ class cachestore_redis_compressor_test extends advanced_testcase { /** * Test set up */ - public function setUp() { + public function setUp(): void { if (!cachestore_redis::are_requirements_met() || !defined('TEST_CACHESTORE_REDIS_TESTSERVERS')) { $this->markTestSkipped('Could not test cachestore_redis. Requirements are not met.'); } diff --git a/cache/stores/redis/tests/redis_test.php b/cache/stores/redis/tests/redis_test.php index 1fa3861b5c7..a4bd9f79425 100644 --- a/cache/stores/redis/tests/redis_test.php +++ b/cache/stores/redis/tests/redis_test.php @@ -54,13 +54,13 @@ class cachestore_redis_test extends cachestore_tests { return 'cachestore_redis'; } - public function setUp() { + public function setUp(): void { if (!cachestore_redis::are_requirements_met() || !defined('TEST_CACHESTORE_REDIS_TESTSERVERS')) { $this->markTestSkipped('Could not test cachestore_redis. Requirements are not met.'); } parent::setUp(); } - protected function tearDown() { + protected function tearDown(): void { parent::tearDown(); if ($this->store instanceof cachestore_redis) { @@ -123,4 +123,4 @@ class cachestore_redis_test extends cachestore_tests { $this->assertFalse($store->release_lock('lock', '321')); $this->assertTrue($store->release_lock('lock', '123')); } -} \ No newline at end of file +} diff --git a/cache/tests/administration_helper_test.php b/cache/tests/administration_helper_test.php index 146efe34abc..b392114fb51 100644 --- a/cache/tests/administration_helper_test.php +++ b/cache/tests/administration_helper_test.php @@ -45,7 +45,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase { /** * Set things back to the default before each test. */ - public function setUp() { + public function setUp(): void { parent::setUp(); cache_factory::reset(); cache_config_testing::create_default_configuration(); @@ -54,7 +54,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase { /** * Final task is to reset the cache system */ - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { parent::tearDownAfterClass(); cache_factory::reset(); } diff --git a/cache/tests/cache_test.php b/cache/tests/cache_test.php index faafe51449d..ffbb1dfd53e 100644 --- a/cache/tests/cache_test.php +++ b/cache/tests/cache_test.php @@ -44,7 +44,7 @@ class core_cache_testcase extends advanced_testcase { /** * Set things back to the default before each test. */ - public function setUp() { + public function setUp(): void { parent::setUp(); cache_factory::reset(); cache_config_testing::create_default_configuration(); @@ -53,7 +53,7 @@ class core_cache_testcase extends advanced_testcase { /** * Final task is to reset the cache system */ - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { parent::tearDownAfterClass(); cache_factory::reset(); } diff --git a/cache/tests/config_writer_test.php b/cache/tests/config_writer_test.php index 12b6291ed75..8fa28d737c7 100644 --- a/cache/tests/config_writer_test.php +++ b/cache/tests/config_writer_test.php @@ -44,7 +44,7 @@ class core_cache_config_writer_testcase extends advanced_testcase { /** * Set things back to the default before each test. */ - public function setUp() { + public function setUp(): void { parent::setUp(); cache_factory::reset(); cache_config_testing::create_default_configuration(); @@ -53,7 +53,7 @@ class core_cache_config_writer_testcase extends advanced_testcase { /** * Final task is to reset the cache system */ - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { parent::tearDownAfterClass(); cache_factory::reset(); } diff --git a/cache/tests/fixtures/stores.php b/cache/tests/fixtures/stores.php index 0eee86e377f..b266f4e1d69 100644 --- a/cache/tests/fixtures/stores.php +++ b/cache/tests/fixtures/stores.php @@ -46,7 +46,7 @@ abstract class cachestore_tests extends advanced_testcase { * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - public function setUp() { + public function setUp(): void { $class = $this->get_class_name(); if (!class_exists($class) || !$class::are_requirements_met()) { $this->markTestSkipped('Could not test '.$class.'. Requirements are not met.'); @@ -190,4 +190,4 @@ abstract class cachestore_tests extends advanced_testcase { $this->assertSame(3, $instance->delete_many(array('many2', 'many3', 'many4'))); $this->assertSame(2, $instance->delete_many(array('many1', 'many5', 'many6'))); } -} \ No newline at end of file +} diff --git a/calendar/tests/calendartype_test.php b/calendar/tests/calendartype_test.php index 859acc6f197..487010b2869 100644 --- a/calendar/tests/calendartype_test.php +++ b/calendar/tests/calendartype_test.php @@ -58,7 +58,7 @@ class core_calendar_type_testcase extends advanced_testcase { /** * Test set up. */ - protected function setUp() { + protected function setUp(): void { // The user we are going to test this on. $this->user = self::getDataGenerator()->create_user(); self::setUser($this->user); diff --git a/calendar/tests/container_test.php b/calendar/tests/container_test.php index bc72391ce38..7e00429f270 100644 --- a/calendar/tests/container_test.php +++ b/calendar/tests/container_test.php @@ -47,7 +47,7 @@ class core_calendar_container_testcase extends advanced_testcase { /** * Test setup. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); } diff --git a/calendar/tests/events_related_objects_cache_test.php b/calendar/tests/events_related_objects_cache_test.php index f0799db5347..0238db8047e 100644 --- a/calendar/tests/events_related_objects_cache_test.php +++ b/calendar/tests/events_related_objects_cache_test.php @@ -41,7 +41,7 @@ class core_calendar_events_related_objects_cache_testcase extends advanced_testc /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); } diff --git a/calendar/tests/events_test.php b/calendar/tests/events_test.php index 76f8374effc..fdb852ce80a 100644 --- a/calendar/tests/events_test.php +++ b/calendar/tests/events_test.php @@ -48,7 +48,7 @@ class core_calendar_events_testcase extends advanced_testcase { /** * Test set up. */ - protected function setUp() { + protected function setUp(): void { global $USER; // The user we are going to test this on. $this->setAdminUser(); diff --git a/calendar/tests/externallib_test.php b/calendar/tests/externallib_test.php index 1d41b310bcb..d39596d9e83 100644 --- a/calendar/tests/externallib_test.php +++ b/calendar/tests/externallib_test.php @@ -43,7 +43,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { global $CFG; require_once($CFG->dirroot . '/calendar/externallib.php'); } diff --git a/calendar/tests/lib_test.php b/calendar/tests/lib_test.php index 4467337ce95..d39012581cf 100644 --- a/calendar/tests/lib_test.php +++ b/calendar/tests/lib_test.php @@ -38,7 +38,7 @@ class core_calendar_lib_testcase extends advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); } diff --git a/calendar/tests/local_api_test.php b/calendar/tests/local_api_test.php index 70f56d97666..987de7b3915 100644 --- a/calendar/tests/local_api_test.php +++ b/calendar/tests/local_api_test.php @@ -40,7 +40,7 @@ class core_calendar_local_api_testcase extends advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); } diff --git a/calendar/tests/privacy_test.php b/calendar/tests/privacy_test.php index 2b7157d5dc2..d2173b79a80 100644 --- a/calendar/tests/privacy_test.php +++ b/calendar/tests/privacy_test.php @@ -47,7 +47,7 @@ class core_calendar_privacy_testcase extends provider_testcase { /** * Overriding setUp() function to always reset after tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/calendar/tests/rrule_manager_test.php b/calendar/tests/rrule_manager_test.php index a6e2531e658..3af4655cb8c 100644 --- a/calendar/tests/rrule_manager_test.php +++ b/calendar/tests/rrule_manager_test.php @@ -46,7 +46,7 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase { /** * Set up method. */ - protected function setUp() { + protected function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/calendar/tests/std_proxy_test.php b/calendar/tests/std_proxy_test.php index dc9f25e3efb..5d175ac5e95 100644 --- a/calendar/tests/std_proxy_test.php +++ b/calendar/tests/std_proxy_test.php @@ -38,7 +38,7 @@ class core_calendar_std_proxy_testcase extends advanced_testcase { */ public $objects; - public function setUp() { + public function setUp(): void { $this->objects = [ 1 => (object) [ 'member1' => 'Hello', diff --git a/cohort/tests/privacy_test.php b/cohort/tests/privacy_test.php index 71a70804eab..c6c04bc9a72 100644 --- a/cohort/tests/privacy_test.php +++ b/cohort/tests/privacy_test.php @@ -42,7 +42,7 @@ class core_cohort_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/comment/tests/externallib_test.php b/comment/tests/externallib_test.php index b9473923d54..ea79b8bdded 100644 --- a/comment/tests/externallib_test.php +++ b/comment/tests/externallib_test.php @@ -44,7 +44,7 @@ class core_comment_externallib_testcase extends externallib_advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); } diff --git a/comment/tests/privacy_test.php b/comment/tests/privacy_test.php index b2f7ba2d7eb..45e2093258c 100644 --- a/comment/tests/privacy_test.php +++ b/comment/tests/privacy_test.php @@ -38,7 +38,7 @@ use \core_privacy\tests\provider_testcase; */ class core_comment_privacy_testcase extends provider_testcase { - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); } diff --git a/competency/tests/external_test.php b/competency/tests/external_test.php index 83247d136a5..c2ddd7af698 100644 --- a/competency/tests/external_test.php +++ b/competency/tests/external_test.php @@ -96,7 +96,7 @@ class core_competency_external_testcase extends externallib_advanced_testcase { /** * Setup function- we will create a course and add an assign instance to it. */ - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; $this->resetAfterTest(true); diff --git a/competency/tests/privacy_test.php b/competency/tests/privacy_test.php index 7105753f50d..4ba3a69b155 100644 --- a/competency/tests/privacy_test.php +++ b/competency/tests/privacy_test.php @@ -48,7 +48,7 @@ use core_competency\privacy\provider; */ class core_competency_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { global $PAGE; $this->resetAfterTest(); diff --git a/completion/tests/api_test.php b/completion/tests/api_test.php index af24c079a84..984393e70b0 100644 --- a/completion/tests/api_test.php +++ b/completion/tests/api_test.php @@ -38,7 +38,7 @@ class core_completion_api_testcase extends advanced_testcase { /** * Test setup. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/completion/tests/progress_test.php b/completion/tests/progress_test.php index fded21991e3..2ea3061a0f8 100644 --- a/completion/tests/progress_test.php +++ b/completion/tests/progress_test.php @@ -38,7 +38,7 @@ class core_completion_progress_testcase extends advanced_testcase { /** * Test setup. */ - public function setUp() { + public function setUp(): void { global $CFG; $CFG->enablecompletion = true; diff --git a/course/format/weeks/tests/observer_test.php b/course/format/weeks/tests/observer_test.php index 6e737d6ba15..5d833b12664 100644 --- a/course/format/weeks/tests/observer_test.php +++ b/course/format/weeks/tests/observer_test.php @@ -36,7 +36,7 @@ class format_weeks_observer_testcase extends advanced_testcase { /** * Test setup. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/course/tests/category_hooks_test.php b/course/tests/category_hooks_test.php index 52af5f710d7..4a5cb9a6f97 100644 --- a/course/tests/category_hooks_test.php +++ b/course/tests/category_hooks_test.php @@ -37,7 +37,7 @@ use PHPUnit\Framework\MockObject\MockObject; */ class core_course_category_hooks_testcase extends \advanced_testcase { - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); } diff --git a/course/tests/category_test.php b/course/tests/category_test.php index 8d8b26be765..5d463dec0d1 100644 --- a/course/tests/category_test.php +++ b/course/tests/category_test.php @@ -32,7 +32,7 @@ class core_course_category_testcase extends advanced_testcase { protected $roles; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(); $user = $this->getDataGenerator()->create_user(); diff --git a/course/tests/customfield_test.php b/course/tests/customfield_test.php index 2673208d4e2..64d5ba00460 100644 --- a/course/tests/customfield_test.php +++ b/course/tests/customfield_test.php @@ -40,7 +40,7 @@ class core_course_customfield_testcase extends advanced_testcase { /** * Set up */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(); $this->setAdminUser(); diff --git a/course/tests/events_test.php b/course/tests/events_test.php index 0a30f7e55ef..c3a96186fb9 100644 --- a/course/tests/events_test.php +++ b/course/tests/events_test.php @@ -36,7 +36,7 @@ class core_course_events_testcase extends advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { global $CFG; require_once($CFG->dirroot . '/course/lib.php'); $this->resetAfterTest(); diff --git a/course/tests/externallib_test.php b/course/tests/externallib_test.php index 015632f7d08..648463db376 100644 --- a/course/tests/externallib_test.php +++ b/course/tests/externallib_test.php @@ -42,7 +42,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { global $CFG; require_once($CFG->dirroot . '/course/externallib.php'); } diff --git a/course/tests/search_test.php b/course/tests/search_test.php index 6d03d4852d4..f438ee1dac6 100644 --- a/course/tests/search_test.php +++ b/course/tests/search_test.php @@ -53,7 +53,7 @@ class course_search_testcase extends advanced_testcase { */ protected $customfieldareaid = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); set_config('enableglobalsearch', true); diff --git a/customfield/field/checkbox/tests/plugin_test.php b/customfield/field/checkbox/tests/plugin_test.php index 4d945332990..9a64267af10 100644 --- a/customfield/field/checkbox/tests/plugin_test.php +++ b/customfield/field/checkbox/tests/plugin_test.php @@ -48,7 +48,7 @@ class customfield_checkbox_plugin_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->cfcat = $this->get_generator()->create_category(); diff --git a/customfield/field/date/tests/plugin_test.php b/customfield/field/date/tests/plugin_test.php index 749872287e0..4d52f3bafaf 100644 --- a/customfield/field/date/tests/plugin_test.php +++ b/customfield/field/date/tests/plugin_test.php @@ -48,7 +48,7 @@ class customfield_date_plugin_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->cfcat = $this->get_generator()->create_category(); @@ -206,4 +206,4 @@ class customfield_date_plugin_testcase extends advanced_testcase { public function test_delete() { $this->cfcat->get_handler()->delete_all(); } -} \ No newline at end of file +} diff --git a/customfield/field/select/tests/plugin_test.php b/customfield/field/select/tests/plugin_test.php index 6def88cfa66..937c2b86d15 100644 --- a/customfield/field/select/tests/plugin_test.php +++ b/customfield/field/select/tests/plugin_test.php @@ -48,7 +48,7 @@ class customfield_select_plugin_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->cfcat = $this->get_generator()->create_category(); @@ -199,4 +199,4 @@ class customfield_select_plugin_testcase extends advanced_testcase { public function test_delete() { $this->cfcat->get_handler()->delete_all(); } -} \ No newline at end of file +} diff --git a/customfield/field/text/tests/plugin_test.php b/customfield/field/text/tests/plugin_test.php index 8f625641ef2..b52d5a0685a 100644 --- a/customfield/field/text/tests/plugin_test.php +++ b/customfield/field/text/tests/plugin_test.php @@ -48,7 +48,7 @@ class customfield_text_plugin_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->cfcat = $this->get_generator()->create_category(); diff --git a/customfield/field/textarea/tests/plugin_test.php b/customfield/field/textarea/tests/plugin_test.php index a5cc62d3ccb..9c48ad6e24e 100644 --- a/customfield/field/textarea/tests/plugin_test.php +++ b/customfield/field/textarea/tests/plugin_test.php @@ -48,7 +48,7 @@ class customfield_textarea_plugin_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->cfcat = $this->get_generator()->create_category(); diff --git a/enrol/flatfile/tests/privacy_provider_test.php b/enrol/flatfile/tests/privacy_provider_test.php index 2619389177c..0b99cfc0906 100644 --- a/enrol/flatfile/tests/privacy_provider_test.php +++ b/enrol/flatfile/tests/privacy_provider_test.php @@ -63,7 +63,7 @@ class enrol_flatfile_privacy_testcase extends provider_testcase { /** * Called before every test. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/enrol/imsenterprise/tests/imsenterprise_test.php b/enrol/imsenterprise/tests/imsenterprise_test.php index b0b783a6e3f..bbf3e25cd00 100644 --- a/enrol/imsenterprise/tests/imsenterprise_test.php +++ b/enrol/imsenterprise/tests/imsenterprise_test.php @@ -47,7 +47,7 @@ class enrol_imsenterprise_testcase extends advanced_testcase { /** * Setup required for all tests. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(true); $this->imsplugin = enrol_get_plugin('imsenterprise'); $this->set_test_config(); diff --git a/enrol/lti/tests/data_connector_test.php b/enrol/lti/tests/data_connector_test.php index b01009e6c67..48cb7f0e483 100644 --- a/enrol/lti/tests/data_connector_test.php +++ b/enrol/lti/tests/data_connector_test.php @@ -49,7 +49,7 @@ class enrol_lti_data_connector_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); // Set this user as the admin. diff --git a/enrol/lti/tests/helper_test.php b/enrol/lti/tests/helper_test.php index a601cf7f9d8..75a79cd3209 100644 --- a/enrol/lti/tests/helper_test.php +++ b/enrol/lti/tests/helper_test.php @@ -48,7 +48,7 @@ class enrol_lti_helper_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); // Set this user as the admin. diff --git a/enrol/lti/tests/lib_test.php b/enrol/lti/tests/lib_test.php index 3e478660c9b..5e9873d3398 100644 --- a/enrol/lti/tests/lib_test.php +++ b/enrol/lti/tests/lib_test.php @@ -45,7 +45,7 @@ class enrol_lti_testcase extends advanced_testcase { * * This is executed before running any tests in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); } diff --git a/enrol/lti/tests/privacy_provider_test.php b/enrol/lti/tests/privacy_provider_test.php index 984684cb1ca..dfcaf07dc2d 100644 --- a/enrol/lti/tests/privacy_provider_test.php +++ b/enrol/lti/tests/privacy_provider_test.php @@ -58,7 +58,7 @@ class enrol_lti_privacy_provider_testcase extends \core_privacy\tests\provider_t /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->course = $this->getDataGenerator()->create_course(); diff --git a/enrol/lti/tests/sync_members_test.php b/enrol/lti/tests/sync_members_test.php index f9061bf6d16..e39ec7aaf61 100644 --- a/enrol/lti/tests/sync_members_test.php +++ b/enrol/lti/tests/sync_members_test.php @@ -59,7 +59,7 @@ class sync_members_testcase extends advanced_testcase { /** @var ResourceLink $resourcelink */ protected $resourcelink; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); // Set this user as the admin. diff --git a/enrol/lti/tests/tool_provider_test.php b/enrol/lti/tests/tool_provider_test.php index 5e673ec720f..c05987b5ba0 100644 --- a/enrol/lti/tests/tool_provider_test.php +++ b/enrol/lti/tests/tool_provider_test.php @@ -53,7 +53,7 @@ class tool_provider_testcase extends advanced_testcase { * * This is executed before running any tests in this file. */ - public function setUp() { + public function setUp(): void { global $SESSION; $this->resetAfterTest(); diff --git a/enrol/paypal/tests/privacy_provider_test.php b/enrol/paypal/tests/privacy_provider_test.php index f1077871309..25b63042b42 100644 --- a/enrol/paypal/tests/privacy_provider_test.php +++ b/enrol/paypal/tests/privacy_provider_test.php @@ -79,7 +79,7 @@ class enrol_paypal_privacy_provider_testcase extends \core_privacy\tests\provide /** @var stdClass A test course with 2 enrolments for student2 and student12. */ protected $course3; - protected function setUp() { + protected function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/enrol/tests/course_enrolment_manager_test.php b/enrol/tests/course_enrolment_manager_test.php index 6954ff37c9f..11c4146d410 100644 --- a/enrol/tests/course_enrolment_manager_test.php +++ b/enrol/tests/course_enrolment_manager_test.php @@ -54,7 +54,7 @@ class core_course_enrolment_manager_testcase extends advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { global $CFG; require_once($CFG->dirroot . '/enrol/locallib.php'); $this->setAdminUser(); diff --git a/enrol/tests/role_external_test.php b/enrol/tests/role_external_test.php index 4009101fbf5..64b63f37793 100644 --- a/enrol/tests/role_external_test.php +++ b/enrol/tests/role_external_test.php @@ -35,7 +35,7 @@ class core_enrol_role_external_testcase extends externallib_advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { global $CFG; require_once($CFG->dirroot . '/enrol/externallib.php'); } @@ -142,4 +142,4 @@ class core_enrol_role_external_testcase extends externallib_advanced_testcase { $categories = core_role_external::unassign_roles( array('roleid' => 3, 'userid' => $USER->id, 'contextid' => $context->id)); } -} \ No newline at end of file +} diff --git a/favourites/tests/component_favourite_service_test.php b/favourites/tests/component_favourite_service_test.php index b4440073aaa..cb56a431049 100644 --- a/favourites/tests/component_favourite_service_test.php +++ b/favourites/tests/component_favourite_service_test.php @@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die(); */ class component_favourite_service_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/favourites/tests/privacy_test.php b/favourites/tests/privacy_test.php index 75076890935..d7fe912b9b3 100644 --- a/favourites/tests/privacy_test.php +++ b/favourites/tests/privacy_test.php @@ -37,7 +37,7 @@ use \core_privacy\local\request\transform; */ class privacy_test extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/favourites/tests/repository_test.php b/favourites/tests/repository_test.php index b95451a12e2..d06868a379e 100644 --- a/favourites/tests/repository_test.php +++ b/favourites/tests/repository_test.php @@ -36,7 +36,7 @@ use \core_favourites\local\entity\favourite; */ class favourite_repository_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/favourites/tests/user_favourite_service_test.php b/favourites/tests/user_favourite_service_test.php index be372f17583..f44a6386e0f 100644 --- a/favourites/tests/user_favourite_service_test.php +++ b/favourites/tests/user_favourite_service_test.php @@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die(); */ class user_favourite_service_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/filter/algebra/tests/filter_test.php b/filter/algebra/tests/filter_test.php index 529b9ec415e..fbb8a7bdb70 100644 --- a/filter/algebra/tests/filter_test.php +++ b/filter/algebra/tests/filter_test.php @@ -44,7 +44,7 @@ class filter_algebra_testcase extends basic_testcase { protected $filter; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->filter = new filter_algebra(context_system::instance(), array()); } diff --git a/filter/displayh5p/tests/filter_test.php b/filter/displayh5p/tests/filter_test.php index 467118cea2c..cb9b3c4f790 100644 --- a/filter/displayh5p/tests/filter_test.php +++ b/filter/displayh5p/tests/filter_test.php @@ -36,7 +36,7 @@ require_once($CFG->dirroot.'/filter/displayh5p/filter.php'); */ class filter_displayh5p_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(true); @@ -96,4 +96,4 @@ class filter_displayh5p_testcase extends advanced_testcase { "\"[^>]*?>#"] ]; } -} \ No newline at end of file +} diff --git a/filter/multilang/tests/filter_test.php b/filter/multilang/tests/filter_test.php index 2dbefa2c821..65d8ce37716 100644 --- a/filter/multilang/tests/filter_test.php +++ b/filter/multilang/tests/filter_test.php @@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die(); */ class filter_multilang_filter_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(true); diff --git a/filter/tex/tests/filter_test.php b/filter/tex/tests/filter_test.php index 1b03725f347..02dc2b1b218 100644 --- a/filter/tex/tests/filter_test.php +++ b/filter/tex/tests/filter_test.php @@ -40,7 +40,7 @@ class filter_tex_testcase extends advanced_testcase { protected $filter; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(true); $this->filter = new filter_tex(context_system::instance(), array()); diff --git a/grade/export/ods/tests/logging_test.php b/grade/export/ods/tests/logging_test.php index 67ce6584385..b2e97920749 100644 --- a/grade/export/ods/tests/logging_test.php +++ b/grade/export/ods/tests/logging_test.php @@ -36,7 +36,7 @@ class ods_logging_events_testcase extends advanced_testcase { /** * Setup is called before calling test case. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } @@ -62,4 +62,4 @@ class ods_logging_events_testcase extends advanced_testcase { $this->assertEquals(context_course::instance($course->id), $event->get_context()); $this->assertEquals('ods', $event->get_export_type()); } -} \ No newline at end of file +} diff --git a/grade/export/txt/tests/logging_test.php b/grade/export/txt/tests/logging_test.php index e2e7d7bed74..3bc0b49e3c2 100644 --- a/grade/export/txt/tests/logging_test.php +++ b/grade/export/txt/tests/logging_test.php @@ -36,7 +36,7 @@ class txt_logging_events_testcase extends advanced_testcase { /** * Setup is called before calling test case. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } @@ -62,4 +62,4 @@ class txt_logging_events_testcase extends advanced_testcase { $this->assertEquals(context_course::instance($course->id), $event->get_context()); $this->assertEquals('txt', $event->get_export_type()); } -} \ No newline at end of file +} diff --git a/grade/export/xls/tests/logging_test.php b/grade/export/xls/tests/logging_test.php index fcada0d9e1c..277481f3f2b 100644 --- a/grade/export/xls/tests/logging_test.php +++ b/grade/export/xls/tests/logging_test.php @@ -36,7 +36,7 @@ class xls_logging_events_testcase extends advanced_testcase { /** * Setup is called before calling test case. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } @@ -62,4 +62,4 @@ class xls_logging_events_testcase extends advanced_testcase { $this->assertEquals(context_course::instance($course->id), $event->get_context()); $this->assertEquals('xls', $event->get_export_type()); } -} \ No newline at end of file +} diff --git a/grade/export/xml/tests/logging_test.php b/grade/export/xml/tests/logging_test.php index b88d953126d..2e8263290e5 100644 --- a/grade/export/xml/tests/logging_test.php +++ b/grade/export/xml/tests/logging_test.php @@ -36,7 +36,7 @@ class xml_logging_events_testcase extends advanced_testcase { /** * Setup is called before calling test case. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } @@ -62,4 +62,4 @@ class xml_logging_events_testcase extends advanced_testcase { $this->assertEquals(context_course::instance($course->id), $event->get_context()); $this->assertEquals('xml', $event->get_export_type()); } -} \ No newline at end of file +} diff --git a/grade/import/csv/tests/load_data_test.php b/grade/import/csv/tests/load_data_test.php index f05e8b5e311..b49d16e00bd 100644 --- a/grade/import/csv/tests/load_data_test.php +++ b/grade/import/csv/tests/load_data_test.php @@ -64,7 +64,7 @@ Bobby,Bunce,,"Moodle HQ","Rock on!",student5@example.com,75.00,,75.00,{exportdat /** @var array $columns The first row of the csv file. These are the columns of the import file.*/ protected $columns; - public function tearDown() { + public function tearDown(): void { $this->csvimport = null; } diff --git a/grade/report/grader/tests/privacy_test.php b/grade/report/grader/tests/privacy_test.php index 2be84b674bc..5c8b7a5ba55 100644 --- a/grade/report/grader/tests/privacy_test.php +++ b/grade/report/grader/tests/privacy_test.php @@ -42,7 +42,7 @@ class gradereport_grader_privacy_testcase extends \core_privacy\tests\provider_t /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/grade/report/overview/tests/externallib_test.php b/grade/report/overview/tests/externallib_test.php index 1301c0d84dc..592c0192307 100644 --- a/grade/report/overview/tests/externallib_test.php +++ b/grade/report/overview/tests/externallib_test.php @@ -42,7 +42,7 @@ class gradereport_overview_externallib_testcase extends externallib_advanced_tes /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(true); diff --git a/grade/report/user/tests/lib_test.php b/grade/report/user/tests/lib_test.php index 7af1a71dac2..f1ff2e815ab 100644 --- a/grade/report/user/tests/lib_test.php +++ b/grade/report/user/tests/lib_test.php @@ -51,7 +51,7 @@ class gradereport_user_lib_testcase extends advanced_testcase { */ private $tree; - public function setUp() { + public function setUp(): void { $this->user = $this->getDataGenerator()->create_user(); $this->course = $this->getDataGenerator()->create_course(); $this->tree = new \core_user\output\myprofile\tree(); diff --git a/grade/report/user/tests/privacy_test.php b/grade/report/user/tests/privacy_test.php index b44f8bff378..49a5425963f 100644 --- a/grade/report/user/tests/privacy_test.php +++ b/grade/report/user/tests/privacy_test.php @@ -40,7 +40,7 @@ class gradereport_user_privacy_testcase extends \core_privacy\tests\provider_tes /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/grade/tests/events_test.php b/grade/tests/events_test.php index 5789fcd3f48..1cf7e15ca9b 100644 --- a/grade/tests/events_test.php +++ b/grade/tests/events_test.php @@ -46,7 +46,7 @@ class core_grade_events_test extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); 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 5c8a50b4eef..05494286f56 100644 --- a/grade/tests/grades_grader_gradingpanel_point_external_store_test.php +++ b/grade/tests/grades_grader_gradingpanel_point_external_store_test.php @@ -279,7 +279,7 @@ class store_test extends advanced_testcase { * @param int $maxvalue The max value of the forum * @param int $suppliedvalue The value that was submitted */ - public function test_execute_store_out_of__range(int $maxvalue, int $suppliedvalue): void { + public function test_execute_store_out_of__range(int $maxvalue, float $suppliedvalue): void { $this->resetAfterTest(); $forum = $this->get_forum_instance([ diff --git a/grade/tests/privacy_test.php b/grade/tests/privacy_test.php index d9c2d485450..d721dee8f52 100644 --- a/grade/tests/privacy_test.php +++ b/grade/tests/privacy_test.php @@ -46,7 +46,7 @@ require_once($CFG->libdir . '/gradelib.php'); */ class core_grades_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { global $PAGE; $this->resetAfterTest(); $PAGE->get_renderer('core'); diff --git a/h5p/tests/editor_ajax_test.php b/h5p/tests/editor_ajax_test.php index 13f46c9d861..04ab135033f 100644 --- a/h5p/tests/editor_ajax_test.php +++ b/h5p/tests/editor_ajax_test.php @@ -46,7 +46,7 @@ class editor_ajax_testcase extends \advanced_testcase { /** * Set up function for tests. */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); autoloader::register(); diff --git a/h5p/tests/editor_framework_test.php b/h5p/tests/editor_framework_test.php index 1dd6b8cacd6..8e3e220a8b3 100644 --- a/h5p/tests/editor_framework_test.php +++ b/h5p/tests/editor_framework_test.php @@ -45,7 +45,7 @@ class editor_framework_testcase extends \advanced_testcase { /** * Set up function for tests. */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); autoloader::register(); diff --git a/h5p/tests/event_h5p_deleted_test.php b/h5p/tests/event_h5p_deleted_test.php index c2c65f5766f..89d8ca94104 100644 --- a/h5p/tests/event_h5p_deleted_test.php +++ b/h5p/tests/event_h5p_deleted_test.php @@ -42,7 +42,7 @@ class core_h5p_event_h5p_deleted_testcase extends advanced_testcase { /** * Setup test. */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); autoloader::register(); } diff --git a/h5p/tests/event_h5p_viewed_test.php b/h5p/tests/event_h5p_viewed_test.php index 75a7671b348..73eb2644b25 100644 --- a/h5p/tests/event_h5p_viewed_test.php +++ b/h5p/tests/event_h5p_viewed_test.php @@ -42,7 +42,7 @@ class core_h5p_event_h5p_viewed_testcase extends advanced_testcase { /** * Setup test. */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); autoloader::register(); } diff --git a/h5p/tests/external_test.php b/h5p/tests/external_test.php index 42f1aea2d34..e2a842ac77d 100644 --- a/h5p/tests/external_test.php +++ b/h5p/tests/external_test.php @@ -46,7 +46,7 @@ use core_h5p\local\library\autoloader; */ class core_h5p_external_testcase extends externallib_advanced_testcase { - protected function setUp() { + protected function setUp(): void { parent::setUp(); autoloader::register(); } diff --git a/h5p/tests/framework_test.php b/h5p/tests/framework_test.php index 13883c1c40b..9e5c4492567 100644 --- a/h5p/tests/framework_test.php +++ b/h5p/tests/framework_test.php @@ -44,7 +44,7 @@ class framework_testcase extends \advanced_testcase { /** * Set up function for tests. */ - public function setUp() { + public function setUp(): void { $factory = new \core_h5p\factory(); $this->framework = $factory->get_framework(); } diff --git a/h5p/tests/generator_test.php b/h5p/tests/generator_test.php index 05be9670cd6..b43df426dbb 100644 --- a/h5p/tests/generator_test.php +++ b/h5p/tests/generator_test.php @@ -43,7 +43,7 @@ class generator_testcase extends \advanced_testcase { /** * Tests set up. */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); autoloader::register(); diff --git a/h5p/tests/h5p_core_test.php b/h5p/tests/h5p_core_test.php index d441fdc4c19..a1bcb2c6cce 100644 --- a/h5p/tests/h5p_core_test.php +++ b/h5p/tests/h5p_core_test.php @@ -40,7 +40,7 @@ defined('MOODLE_INTERNAL') || die(); */ class h5p_core_testcase extends \advanced_testcase { - protected function setup() { + protected function setUp(): void { global $CFG; parent::setUp(); diff --git a/h5p/tests/h5p_file_storage_test.php b/h5p/tests/h5p_file_storage_test.php index 8cce6c2ed8c..8199d353ac9 100644 --- a/h5p/tests/h5p_file_storage_test.php +++ b/h5p/tests/h5p_file_storage_test.php @@ -60,7 +60,7 @@ class h5p_file_storage_testcase extends \advanced_testcase { /** @var int $libraryid an id for the library. */ protected $libraryid = 1; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(true); diff --git a/iplookup/tests/geoip_test.php b/iplookup/tests/geoip_test.php index d553bd8938a..f1a8a933ef5 100644 --- a/iplookup/tests/geoip_test.php +++ b/iplookup/tests/geoip_test.php @@ -35,7 +35,7 @@ require_once("{$CFG->dirroot}/iplookup/lib.php"); * GeoIp data file parsing test. */ class core_iplookup_geoip_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/iplookup/tests/geoplugin_test.php b/iplookup/tests/geoplugin_test.php index 79466bc0122..3ebe8b4fc7d 100644 --- a/iplookup/tests/geoplugin_test.php +++ b/iplookup/tests/geoplugin_test.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); */ class core_iplookup_geoplugin_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { global $CFG; require_once("$CFG->libdir/filelib.php"); require_once("$CFG->dirroot/iplookup/lib.php"); diff --git a/lib/antivirus/clamav/tests/scanner_test.php b/lib/antivirus/clamav/tests/scanner_test.php index 87a39b7b904..4a2eca7a10a 100644 --- a/lib/antivirus/clamav/tests/scanner_test.php +++ b/lib/antivirus/clamav/tests/scanner_test.php @@ -29,7 +29,7 @@ class antivirus_clamav_scanner_testcase extends advanced_testcase { /** @var string temporary file used in testing */ protected $tempfile; - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); // Create tempfile. @@ -38,7 +38,7 @@ class antivirus_clamav_scanner_testcase extends advanced_testcase { touch($this->tempfile); } - protected function tearDown() { + protected function tearDown(): void { @unlink($this->tempfile); } diff --git a/lib/ddl/tests/ddl_test.php b/lib/ddl/tests/ddl_test.php index 852b9e95133..35526acdf4e 100644 --- a/lib/ddl/tests/ddl_test.php +++ b/lib/ddl/tests/ddl_test.php @@ -31,7 +31,7 @@ class core_ddl_testcase extends database_driver_testcase { /** @var array table name => array of stdClass test records loaded into that table. Created in setUp. */ private $records = array(); - protected function setUp() { + protected function setUp(): void { parent::setUp(); $dbman = $this->tdb->get_manager(); // Loads DDL libs. diff --git a/lib/dml/tests/dml_test.php b/lib/dml/tests/dml_test.php index e23a456d573..d55c8094dea 100644 --- a/lib/dml/tests/dml_test.php +++ b/lib/dml/tests/dml_test.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); class core_dml_testcase extends database_driver_testcase { - protected function setUp() { + protected function setUp(): void { parent::setUp(); $dbman = $this->tdb->get_manager(); // Loads DDL libs. } diff --git a/lib/dml/tests/pgsql_native_recordset_test.php b/lib/dml/tests/pgsql_native_recordset_test.php index 690d1283031..53a2ff1d32e 100644 --- a/lib/dml/tests/pgsql_native_recordset_test.php +++ b/lib/dml/tests/pgsql_native_recordset_test.php @@ -44,7 +44,7 @@ class pgsql_native_recordset_testcase extends basic_testcase { /** * Creates a second db connection and a temp table with values in for testing. */ - protected function setUp() { + protected function setUp(): void { global $DB; parent::setUp(); @@ -87,7 +87,7 @@ class pgsql_native_recordset_testcase extends basic_testcase { /** * Gets rid of the second db connection. */ - protected function tearDown() { + protected function tearDown(): void { if ($this->specialdb) { $table = new xmldb_table('silly_test_table'); $this->specialdb->get_manager()->drop_table($table); diff --git a/lib/dml/tests/recordset_walk_test.php b/lib/dml/tests/recordset_walk_test.php index bab70450a55..17b58df1034 100644 --- a/lib/dml/tests/recordset_walk_test.php +++ b/lib/dml/tests/recordset_walk_test.php @@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die(); */ class core_recordset_walk_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); } diff --git a/lib/dml/tests/sqlsrv_native_moodle_database_test.php b/lib/dml/tests/sqlsrv_native_moodle_database_test.php index 8736d795b8e..e5f08e8ed9d 100644 --- a/lib/dml/tests/sqlsrv_native_moodle_database_test.php +++ b/lib/dml/tests/sqlsrv_native_moodle_database_test.php @@ -38,7 +38,7 @@ require_once($CFG->dirroot.'/lib/dml/sqlsrv_native_moodle_database.php'); */ class sqlsrv_native_moodle_database_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); } diff --git a/lib/filebrowser/tests/file_browser_test.php b/lib/filebrowser/tests/file_browser_test.php index 2959646fc1f..064140854bf 100644 --- a/lib/filebrowser/tests/file_browser_test.php +++ b/lib/filebrowser/tests/file_browser_test.php @@ -59,7 +59,7 @@ class file_browser_testcase extends advanced_testcase { /** * Set up */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/lib/filestorage/tests/file_system_filedir_test.php b/lib/filestorage/tests/file_system_filedir_test.php index 525d7706ae2..24653715fb6 100644 --- a/lib/filestorage/tests/file_system_filedir_test.php +++ b/lib/filestorage/tests/file_system_filedir_test.php @@ -43,7 +43,7 @@ class core_files_file_system_filedir_testcase extends advanced_testcase { /** * Shared test setUp. */ - public function setUp() { + public function setUp(): void { // Reset the file storage so that subsequent fetches to get_file_storage are called after // configuration is prepared. get_file_storage(true); @@ -52,7 +52,7 @@ class core_files_file_system_filedir_testcase extends advanced_testcase { /** * Shared teset tearDown. */ - public function tearDown() { + public function tearDown(): void { // Reset the file storage so that subsequent tests will use the standard file storage. get_file_storage(true); } diff --git a/lib/filestorage/tests/file_system_test.php b/lib/filestorage/tests/file_system_test.php index 387d047aecd..4858c1c7c96 100644 --- a/lib/filestorage/tests/file_system_test.php +++ b/lib/filestorage/tests/file_system_test.php @@ -39,11 +39,11 @@ require_once($CFG->libdir . '/filestorage/file_system.php'); */ class core_files_file_system_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { get_file_storage(true); } - public function tearDown() { + public function tearDown(): void { get_file_storage(true); } diff --git a/lib/filestorage/tests/zip_packer_test.php b/lib/filestorage/tests/zip_packer_test.php index 4b36265e2b9..56fd859c829 100644 --- a/lib/filestorage/tests/zip_packer_test.php +++ b/lib/filestorage/tests/zip_packer_test.php @@ -37,7 +37,7 @@ class core_files_zip_packer_testcase extends advanced_testcase implements file_p */ protected $progress; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->testfile = __DIR__.'/fixtures/test.txt'; diff --git a/lib/form/tests/dateselector_test.php b/lib/form/tests/dateselector_test.php index 12934141c68..96052209f2b 100644 --- a/lib/form/tests/dateselector_test.php +++ b/lib/form/tests/dateselector_test.php @@ -50,7 +50,7 @@ class core_form_dateselector_testcase extends advanced_testcase { /** * Initalize test wide variable, it is called in start of the testcase */ - protected function setUp() { + protected function setUp(): void { global $CFG; parent::setUp(); diff --git a/lib/form/tests/datetimeselector_test.php b/lib/form/tests/datetimeselector_test.php index ec452128254..6e635b35a97 100644 --- a/lib/form/tests/datetimeselector_test.php +++ b/lib/form/tests/datetimeselector_test.php @@ -50,7 +50,7 @@ class core_form_datetimeselector_testcase extends advanced_testcase { /** * Initalize test wide variable, it is called in start of the testcase */ - protected function setUp() { + protected function setUp(): void { global $CFG; parent::setUp(); diff --git a/lib/grade/tests/fixtures/lib.php b/lib/grade/tests/fixtures/lib.php index e2203a29d5a..16050c828d2 100644 --- a/lib/grade/tests/fixtures/lib.php +++ b/lib/grade/tests/fixtures/lib.php @@ -49,7 +49,7 @@ abstract class grade_base_testcase extends advanced_testcase { protected $courseid; protected $userid; - protected function setUp() { + protected function setUp(): void { global $CFG; parent::setup(); diff --git a/lib/phpunit/classes/database_driver_testcase.php b/lib/phpunit/classes/database_driver_testcase.php index 63a99d4d802..a255208276a 100644 --- a/lib/phpunit/classes/database_driver_testcase.php +++ b/lib/phpunit/classes/database_driver_testcase.php @@ -67,7 +67,7 @@ abstract class database_driver_testcase extends base_testcase { $this->setRunTestInSeparateProcess(false); } - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; parent::setUpBeforeClass(); @@ -101,7 +101,7 @@ abstract class database_driver_testcase extends base_testcase { self::$extradb = $d; } - protected function setUp() { + protected function setUp(): void { global $DB; parent::setUp(); @@ -112,7 +112,7 @@ abstract class database_driver_testcase extends base_testcase { } } - protected function tearDown() { + protected function tearDown(): void { // delete all test tables $dbman = $this->tdb->get_manager(); $tables = $this->tdb->get_tables(false); @@ -125,7 +125,7 @@ abstract class database_driver_testcase extends base_testcase { parent::tearDown(); } - public static function tearDownAfterClass() { + public static function tearDownAfterClass(): void { if (self::$extradb) { self::$extradb->dispose(); self::$extradb = null; diff --git a/lib/phpunit/classes/restore_date_testcase.php b/lib/phpunit/classes/restore_date_testcase.php index bc80ae79af7..48d0412118d 100644 --- a/lib/phpunit/classes/restore_date_testcase.php +++ b/lib/phpunit/classes/restore_date_testcase.php @@ -51,7 +51,7 @@ abstract class restore_date_testcase extends advanced_testcase { /** * Setup. */ - public function setUp() { + public function setUp(): void { global $CFG; parent::setUp(); @@ -160,4 +160,4 @@ abstract class restore_date_testcase extends advanced_testcase { return ($this->restorestartdate - $this->startdate); } -} \ No newline at end of file +} diff --git a/lib/phpunit/tests/basic_test.php b/lib/phpunit/tests/basic_test.php index 04b75c5caee..9ef7e1d995b 100644 --- a/lib/phpunit/tests/basic_test.php +++ b/lib/phpunit/tests/basic_test.php @@ -37,7 +37,7 @@ defined('MOODLE_INTERNAL') || die(); class core_phpunit_basic_testcase extends basic_testcase { protected $testassertexecuted = false; - protected function setUp() { + protected function setUp(): void { parent::setUp(); if ($this->getName() === 'test_setup_assert') { $this->assertTrue(true); diff --git a/lib/tests/ajaxlib_test.php b/lib/tests/ajaxlib_test.php index 18b459463a2..4ce4ca9d2a4 100644 --- a/lib/tests/ajaxlib_test.php +++ b/lib/tests/ajaxlib_test.php @@ -29,7 +29,7 @@ class core_ajaxlib_testcase extends advanced_testcase { /** @var string Original error log */ protected $oldlog; - protected function setUp() { + protected function setUp(): void { global $CFG; parent::setUp(); @@ -38,7 +38,7 @@ class core_ajaxlib_testcase extends advanced_testcase { ini_set('error_log', "$CFG->dataroot/testlog.log"); } - protected function tearDown() { + protected function tearDown(): void { ini_set('error_log', $this->oldlog); parent::tearDown(); } diff --git a/lib/tests/antivirus_test.php b/lib/tests/antivirus_test.php index 96fb1ce8b7c..fb92f8e013b 100644 --- a/lib/tests/antivirus_test.php +++ b/lib/tests/antivirus_test.php @@ -29,7 +29,7 @@ require_once(__DIR__ . '/fixtures/testable_antivirus.php'); class core_antivirus_testcase extends advanced_testcase { protected $tempfile; - protected function setUp() { + protected function setUp(): void { global $CFG; // Use our special testable fixture plugin. $CFG->antiviruses = 'testable'; @@ -42,7 +42,7 @@ class core_antivirus_testcase extends advanced_testcase { touch($this->tempfile); } - protected function tearDown() { + protected function tearDown(): void { @unlink($this->tempfile); } diff --git a/lib/tests/blocklib_test.php b/lib/tests/blocklib_test.php index 1cf455261c9..4fbd0a64416 100644 --- a/lib/tests/blocklib_test.php +++ b/lib/tests/blocklib_test.php @@ -39,7 +39,7 @@ class core_blocklib_testcase extends advanced_testcase { protected $blockmanager; protected $isediting = null; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->testpage = new moodle_page(); $this->testpage->set_context(context_system::instance()); @@ -47,7 +47,7 @@ class core_blocklib_testcase extends advanced_testcase { $this->blockmanager = new testable_block_manager($this->testpage); } - protected function tearDown() { + protected function tearDown(): void { $this->testpage = null; $this->blockmanager = null; parent::tearDown(); diff --git a/lib/tests/calendar_cron_task_test.php b/lib/tests/calendar_cron_task_test.php index 6b099876807..a880f9b0ff6 100644 --- a/lib/tests/calendar_cron_task_test.php +++ b/lib/tests/calendar_cron_task_test.php @@ -39,7 +39,7 @@ class core_calendar_cron_task_testcase extends advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); } diff --git a/lib/tests/collator_test.php b/lib/tests/collator_test.php index 7fb9eddb158..94604fec862 100644 --- a/lib/tests/collator_test.php +++ b/lib/tests/collator_test.php @@ -48,7 +48,7 @@ class core_collator_testcase extends advanced_testcase { /** * Prepares things for this test case. */ - protected function setUp() { + protected function setUp(): void { global $SESSION; if (isset($SESSION->lang)) { $this->initiallang = $SESSION->lang; @@ -65,7 +65,7 @@ class core_collator_testcase extends advanced_testcase { /** * Cleans things up after this test case has run. */ - protected function tearDown() { + protected function tearDown(): void { global $SESSION; parent::tearDown(); if ($this->initiallang !== null) { diff --git a/lib/tests/component_test.php b/lib/tests/component_test.php index f66a69daab1..0111d669672 100644 --- a/lib/tests/component_test.php +++ b/lib/tests/component_test.php @@ -38,7 +38,7 @@ class core_component_testcase extends advanced_testcase { */ const SUBSYSTEMCOUNT = 71; - public function setUp() { + public function setUp(): void { $psr0namespaces = new ReflectionProperty('core_component', 'psr0namespaces'); $psr0namespaces->setAccessible(true); $this->oldpsr0namespaces = $psr0namespaces->getValue(null); @@ -47,7 +47,7 @@ class core_component_testcase extends advanced_testcase { $psr4namespaces->setAccessible(true); $this->oldpsr4namespaces = $psr4namespaces->getValue(null); } - public function tearDown() { + public function tearDown(): void { $psr0namespaces = new ReflectionProperty('core_component', 'psr0namespaces'); $psr0namespaces->setAccessible(true); $psr0namespaces->setValue(null, $this->oldpsr0namespaces); diff --git a/lib/tests/core_media_player_native.php b/lib/tests/core_media_player_native.php index c7e925bf7f5..5feb310d138 100644 --- a/lib/tests/core_media_player_native.php +++ b/lib/tests/core_media_player_native.php @@ -40,7 +40,7 @@ class core_media_player_native_testcase extends advanced_testcase { /** * Pre-test setup. */ - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); } @@ -160,4 +160,4 @@ class core_media_player_native_testcase extends advanced_testcase { $this->assertNotContains('', $content); $this->assertNotContains('', $content); } -} \ No newline at end of file +} diff --git a/lib/tests/csvclass_test.php b/lib/tests/csvclass_test.php index 55e84d14e67..7d7523b8c6d 100644 --- a/lib/tests/csvclass_test.php +++ b/lib/tests/csvclass_test.php @@ -36,7 +36,7 @@ class core_csvclass_testcase extends advanced_testcase { protected $teststring3 = ''; protected $teststring4 = ''; - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); diff --git a/lib/tests/customcontext_test.php b/lib/tests/customcontext_test.php index eaa2f3c888e..7dcd228f7f2 100644 --- a/lib/tests/customcontext_test.php +++ b/lib/tests/customcontext_test.php @@ -103,7 +103,7 @@ class customcontext_testcase extends advanced_testcase { /** * Perform setup before every test. This tells Moodle's phpunit to reset the database after every test. */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(true); } diff --git a/lib/tests/event/contentbank_content_created_test.php b/lib/tests/event/contentbank_content_created_test.php index 0e381b9e6d3..70a9f587aaa 100644 --- a/lib/tests/event/contentbank_content_created_test.php +++ b/lib/tests/event/contentbank_content_created_test.php @@ -39,7 +39,7 @@ class contentbank_content_created_testcase extends \advanced_testcase { /** * Setup to ensure that fixtures are loaded. */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php'); diff --git a/lib/tests/event/contentbank_content_deleted_test.php b/lib/tests/event/contentbank_content_deleted_test.php index 20c7517d846..5604bd8fe29 100644 --- a/lib/tests/event/contentbank_content_deleted_test.php +++ b/lib/tests/event/contentbank_content_deleted_test.php @@ -39,7 +39,7 @@ class contentbank_content_deleted_testcase extends \advanced_testcase { /** * Setup to ensure that fixtures are loaded. */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php'); diff --git a/lib/tests/event/contentbank_content_updated_test.php b/lib/tests/event/contentbank_content_updated_test.php index b6aeae790d3..e5fc2979683 100644 --- a/lib/tests/event/contentbank_content_updated_test.php +++ b/lib/tests/event/contentbank_content_updated_test.php @@ -39,7 +39,7 @@ class contentbank_content_updated_testcase extends \advanced_testcase { /** * Setup to ensure that fixtures are loaded. */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php'); diff --git a/lib/tests/event/contentbank_content_uploaded_test.php b/lib/tests/event/contentbank_content_uploaded_test.php index 93e6d7d045d..8e1fe8da262 100644 --- a/lib/tests/event/contentbank_content_uploaded_test.php +++ b/lib/tests/event/contentbank_content_uploaded_test.php @@ -41,7 +41,7 @@ class contentbank_content_uploaded_testcase extends \advanced_testcase { /** * Setup to ensure that fixtures are loaded. */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php'); diff --git a/lib/tests/event/contentbank_content_viewed_test.php b/lib/tests/event/contentbank_content_viewed_test.php index 3cf66ded4a1..e2bb7867fa2 100644 --- a/lib/tests/event/contentbank_content_viewed_test.php +++ b/lib/tests/event/contentbank_content_viewed_test.php @@ -39,7 +39,7 @@ class contentbank_content_viewed_testcase extends \advanced_testcase { /** * Setup to ensure that fixtures are loaded. */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php'); diff --git a/lib/tests/event_profile_field_test.php b/lib/tests/event_profile_field_test.php index b60f301a649..82154e7dcae 100644 --- a/lib/tests/event_profile_field_test.php +++ b/lib/tests/event_profile_field_test.php @@ -42,7 +42,7 @@ class core_event_profile_field_testcase extends advanced_testcase { /** * Test set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/lib/tests/event_user_graded_test.php b/lib/tests/event_user_graded_test.php index b0eb08497a1..e30e30ab033 100644 --- a/lib/tests/event_user_graded_test.php +++ b/lib/tests/event_user_graded_test.php @@ -44,7 +44,7 @@ class core_event_user_graded_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/lib/tests/events_test.php b/lib/tests/events_test.php index 9fc766aa1d6..fe1d24a65f7 100644 --- a/lib/tests/events_test.php +++ b/lib/tests/events_test.php @@ -34,7 +34,7 @@ class core_events_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/lib/tests/exporter_test.php b/lib/tests/exporter_test.php index b56cd130655..7b227577920 100644 --- a/lib/tests/exporter_test.php +++ b/lib/tests/exporter_test.php @@ -39,7 +39,7 @@ class core_exporter_testcase extends advanced_testcase { protected $validdata = null; protected $invaliddata = null; - public function setUp() { + public function setUp(): void { $s = new stdClass(); $this->validrelated = array( 'simplestdClass' => $s, diff --git a/lib/tests/externallib_test.php b/lib/tests/externallib_test.php index aa8101f3f4e..3d91acd1997 100644 --- a/lib/tests/externallib_test.php +++ b/lib/tests/externallib_test.php @@ -32,11 +32,11 @@ require_once($CFG->libdir . '/externallib.php'); class core_externallib_testcase extends advanced_testcase { protected $DB; - public function setUp() { + public function setUp(): void { $this->DB = null; } - public function tearDown() { + public function tearDown(): void { global $DB; if ($this->DB !== null) { $DB = $this->DB; diff --git a/lib/tests/gdlib_test.php b/lib/tests/gdlib_test.php index 8875c3c87d5..edc6d1df77b 100644 --- a/lib/tests/gdlib_test.php +++ b/lib/tests/gdlib_test.php @@ -38,7 +38,7 @@ class core_gdlib_testcase extends basic_testcase { private $fixturepath = null; - public function setUp() { + public function setUp(): void { $this->fixturepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR; } diff --git a/lib/tests/h5p_get_content_types_task_test.php b/lib/tests/h5p_get_content_types_task_test.php index 3502a1bf285..00ac6183d27 100644 --- a/lib/tests/h5p_get_content_types_task_test.php +++ b/lib/tests/h5p_get_content_types_task_test.php @@ -38,7 +38,7 @@ defined('MOODLE_INTERNAL') || die(); */ class h5p_get_content_types_task_testcase extends advanced_testcase { - protected function setup() { + protected function setup(): void { global $CFG; parent::setUp(); diff --git a/lib/tests/lock_test.php b/lib/tests/lock_test.php index 2064621b2d3..d7c32111223 100644 --- a/lib/tests/lock_test.php +++ b/lib/tests/lock_test.php @@ -39,7 +39,7 @@ class lock_testcase extends advanced_testcase { /** * Some lock types will store data in the database. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(true); } diff --git a/lib/tests/medialib_test.php b/lib/tests/medialib_test.php index 8b230c94b1b..d92ba7a464f 100644 --- a/lib/tests/medialib_test.php +++ b/lib/tests/medialib_test.php @@ -34,7 +34,7 @@ class core_medialib_testcase extends advanced_testcase { /** * Pre-test setup. Preserves $CFG. */ - public function setUp() { + public function setUp(): void { parent::setUp(); // Reset $CFG and $SERVER. @@ -496,4 +496,4 @@ class core_medialib_testcase extends advanced_testcase { } return $out; } -} \ No newline at end of file +} diff --git a/lib/tests/moodle_page_test.php b/lib/tests/moodle_page_test.php index bd68624333e..0159a6c5bec 100644 --- a/lib/tests/moodle_page_test.php +++ b/lib/tests/moodle_page_test.php @@ -37,7 +37,7 @@ class core_moodle_page_testcase extends advanced_testcase { */ protected $testpage; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); $this->testpage = new testable_moodle_page(); diff --git a/lib/tests/myprofilelib_test.php b/lib/tests/myprofilelib_test.php index 6cb5dc91be3..20476c0d695 100644 --- a/lib/tests/myprofilelib_test.php +++ b/lib/tests/myprofilelib_test.php @@ -51,7 +51,7 @@ class core_myprofilelib_testcase extends advanced_testcase { */ private $tree; - public function setUp() { + public function setUp(): void { // Set the $PAGE->url value so core_myprofile_navigation() doesn't complain. global $PAGE; $PAGE->set_url('/test'); diff --git a/lib/tests/notification_test.php b/lib/tests/notification_test.php index 50d5adcd478..33078fe8d37 100644 --- a/lib/tests/notification_test.php +++ b/lib/tests/notification_test.php @@ -42,7 +42,7 @@ class core_notification_testcase extends advanced_testcase { * This includes emptying the list of notifications on the session, resetting any session which exists, and setting * up a new moodle_page object. */ - public function setUp() { + public function setUp(): void { global $PAGE, $SESSION; parent::setUp(); @@ -57,7 +57,7 @@ class core_notification_testcase extends advanced_testcase { * This includes emptying the list of notifications on the session, resetting any session which exists, and setting * up a new moodle_page object. */ - public function tearDown() { + public function tearDown(): void { global $PAGE, $SESSION; $PAGE = null; diff --git a/lib/tests/persistent_test.php b/lib/tests/persistent_test.php index 9446e2a5aec..711903e1c98 100644 --- a/lib/tests/persistent_test.php +++ b/lib/tests/persistent_test.php @@ -34,7 +34,7 @@ global $CFG; */ class core_persistent_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->make_persistent_table(); $this->resetAfterTest(); } diff --git a/lib/tests/plugin_manager_test.php b/lib/tests/plugin_manager_test.php index 009c57eae5f..41a7957244c 100644 --- a/lib/tests/plugin_manager_test.php +++ b/lib/tests/plugin_manager_test.php @@ -34,7 +34,7 @@ require_once($CFG->dirroot.'/lib/tests/fixtures/testable_plugininfo_base.php'); */ class core_plugin_manager_testcase extends advanced_testcase { - public function tearDown() { + public function tearDown(): void { // The caches of the testable singleton must be reset explicitly. It is // safer to kill the whole testable singleton at the end of every test. testable_core_plugin_manager::reset_caches(); diff --git a/lib/tests/plugininfo/base_test.php b/lib/tests/plugininfo/base_test.php index d5b805fa992..e8f55661717 100644 --- a/lib/tests/plugininfo/base_test.php +++ b/lib/tests/plugininfo/base_test.php @@ -50,7 +50,7 @@ class base_testcase extends \advanced_testcase { /** * Tear down the testable plugin manager singleton between tests. */ - public function tearDown() { + public function tearDown(): void { // The caches of the testable singleton must be reset explicitly. It is // safer to kill the whole testable singleton at the end of every test. testable_core_plugin_manager::reset_caches(); diff --git a/lib/tests/questionlib_test.php b/lib/tests/questionlib_test.php index 3b79c46dac7..0ffa10cfe77 100644 --- a/lib/tests/questionlib_test.php +++ b/lib/tests/questionlib_test.php @@ -49,7 +49,7 @@ class core_questionlib_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/lib/tests/rsslib_test.php b/lib/tests/rsslib_test.php index c724f6a53b8..0db975b54a4 100644 --- a/lib/tests/rsslib_test.php +++ b/lib/tests/rsslib_test.php @@ -40,7 +40,7 @@ class core_rsslib_testcase extends advanced_testcase { // The number of seconds tests should wait for the server to respond (high to prevent false positives). const TIMEOUT = 10; - protected function setUp() { + protected function setUp(): void { moodle_simplepie::reset_cache(); } diff --git a/lib/tests/session_redis_test.php b/lib/tests/session_redis_test.php index cadbc3b5a34..46373d61ace 100644 --- a/lib/tests/session_redis_test.php +++ b/lib/tests/session_redis_test.php @@ -47,7 +47,7 @@ class core_session_redis_testcase extends advanced_testcase { /** @var $redis The current testing redis connection */ protected $redis = null; - public function setUp() { + public function setUp(): void { global $CFG; if (!extension_loaded('redis')) { @@ -79,7 +79,7 @@ class core_session_redis_testcase extends advanced_testcase { $this->redis->connect(TEST_SESSION_REDIS_HOST); } - public function tearDown() { + public function tearDown(): void { if (!extension_loaded('redis') || !defined('TEST_SESSION_REDIS_HOST')) { return; } diff --git a/lib/tests/statslib_test.php b/lib/tests/statslib_test.php index 7af80e024f8..7e45f9acbab 100644 --- a/lib/tests/statslib_test.php +++ b/lib/tests/statslib_test.php @@ -52,7 +52,7 @@ class core_statslib_testcase extends advanced_testcase { * Setup function * - Allow changes to CFG->debug for testing purposes. */ - protected function setUp() { + protected function setUp(): void { global $CFG, $DB; parent::setUp(); diff --git a/lib/tests/task_database_logger_test.php b/lib/tests/task_database_logger_test.php index d2c43b241a4..4ae0a661311 100644 --- a/lib/tests/task_database_logger_test.php +++ b/lib/tests/task_database_logger_test.php @@ -43,7 +43,7 @@ class task_database_logger_testcase extends advanced_testcase { /** * Setup to backup the database before mocking. */ - public function setUp() { + public function setUp(): void { global $DB; $this->DB = $DB; @@ -52,7 +52,7 @@ class task_database_logger_testcase extends advanced_testcase { /** * Tear down to unmock the database where it was mocked. */ - public function tearDown() { + public function tearDown(): void { global $DB; $DB = $this->DB; diff --git a/lib/tests/task_logging_test.php b/lib/tests/task_logging_test.php index d4f4e12de8b..39b86cd0729 100644 --- a/lib/tests/task_logging_test.php +++ b/lib/tests/task_logging_test.php @@ -43,7 +43,7 @@ class core_task_logmanager extends advanced_testcase { /** * Relevant tearDown for logging tests. */ - public function tearDown() { + public function tearDown(): void { global $DB; // Ensure that any logging is always ended. diff --git a/lib/tests/time_splittings_test.php b/lib/tests/time_splittings_test.php index d36f9b97b18..646bbf48d3d 100644 --- a/lib/tests/time_splittings_test.php +++ b/lib/tests/time_splittings_test.php @@ -44,7 +44,7 @@ class core_analytics_time_splittings_testcase extends advanced_testcase { * * @return void */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); diff --git a/lib/tests/user_test.php b/lib/tests/user_test.php index 6777f1f9caf..ecfd86be462 100644 --- a/lib/tests/user_test.php +++ b/lib/tests/user_test.php @@ -34,7 +34,7 @@ class core_user_testcase extends advanced_testcase { /** * Setup test data. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(true); } diff --git a/lib/tests/useragent_test.php b/lib/tests/useragent_test.php index 28a3b0031a3..9765e9127ed 100644 --- a/lib/tests/useragent_test.php +++ b/lib/tests/useragent_test.php @@ -34,7 +34,7 @@ class core_useragent_testcase extends advanced_testcase { /** * Restores the user agent to the default one. */ - public function tearDown() { + public function tearDown(): void { core_useragent::instance(true); } diff --git a/lib/xapi/tests/external/post_statement_test.php b/lib/xapi/tests/external/post_statement_test.php index 90e5000e64a..e6547a90fcd 100644 --- a/lib/xapi/tests/external/post_statement_test.php +++ b/lib/xapi/tests/external/post_statement_test.php @@ -64,7 +64,7 @@ class post_statement_testcase extends externallib_advanced_testcase { /** * Setup test. */ - public function setUp() { + public function setUp(): void { global $CFG; // We disable group actors on the test xapi_handler. $CFG->xapitestforcegroupactors = false; diff --git a/media/player/html5audio/tests/player_test.php b/media/player/html5audio/tests/player_test.php index 7dfe8e4f1ff..15e0ccdf51e 100644 --- a/media/player/html5audio/tests/player_test.php +++ b/media/player/html5audio/tests/player_test.php @@ -36,7 +36,7 @@ class media_html5audio_testcase extends advanced_testcase { /** * Pre-test setup. Preserves $CFG. */ - public function setUp() { + public function setUp(): void { parent::setUp(); // Reset $CFG and $SERVER. diff --git a/media/player/html5video/tests/player_test.php b/media/player/html5video/tests/player_test.php index 3def9af83af..c4a20c1d715 100644 --- a/media/player/html5video/tests/player_test.php +++ b/media/player/html5video/tests/player_test.php @@ -36,7 +36,7 @@ class media_html5video_testcase extends advanced_testcase { /** * Pre-test setup. Preserves $CFG. */ - public function setUp() { + public function setUp(): void { parent::setUp(); // Reset $CFG and $SERVER. diff --git a/media/player/swf/tests/player_test.php b/media/player/swf/tests/player_test.php index f7b053fc693..d072e33ff38 100644 --- a/media/player/swf/tests/player_test.php +++ b/media/player/swf/tests/player_test.php @@ -36,7 +36,7 @@ class media_swf_testcase extends advanced_testcase { /** * Pre-test setup. Preserves $CFG. */ - public function setUp() { + public function setUp(): void { global $CFG; parent::setUp(); diff --git a/media/player/videojs/tests/player_test.php b/media/player/videojs/tests/player_test.php index aa8de9f56ee..c9069347eb4 100644 --- a/media/player/videojs/tests/player_test.php +++ b/media/player/videojs/tests/player_test.php @@ -36,7 +36,7 @@ class media_videojs_player_testcase extends advanced_testcase { /** * Pre-test setup. Preserves $CFG. */ - public function setUp() { + public function setUp(): void { parent::setUp(); // Reset $CFG and $SERVER. diff --git a/media/player/vimeo/tests/player_test.php b/media/player/vimeo/tests/player_test.php index 3f4dcbf33c6..125e40fb5cc 100644 --- a/media/player/vimeo/tests/player_test.php +++ b/media/player/vimeo/tests/player_test.php @@ -36,7 +36,7 @@ class media_vimeo_testcase extends advanced_testcase { /** * Pre-test setup. Preserves $CFG. */ - public function setUp() { + public function setUp(): void { parent::setUp(); // Reset $CFG and $SERVER. diff --git a/media/player/youtube/tests/player_test.php b/media/player/youtube/tests/player_test.php index 5c9d851731f..b5f298e1124 100644 --- a/media/player/youtube/tests/player_test.php +++ b/media/player/youtube/tests/player_test.php @@ -36,7 +36,7 @@ class media_youtube_testcase extends advanced_testcase { /** * Pre-test setup. Preserves $CFG. */ - public function setUp() { + public function setUp(): void { parent::setUp(); // Reset $CFG and $SERVER. diff --git a/message/output/airnotifier/tests/externallib_test.php b/message/output/airnotifier/tests/externallib_test.php index d0d3a54b668..a4fbbf85245 100644 --- a/message/output/airnotifier/tests/externallib_test.php +++ b/message/output/airnotifier/tests/externallib_test.php @@ -42,7 +42,7 @@ class message_airnotifier_external_testcase extends externallib_advanced_testcas /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { global $CFG; require_once($CFG->dirroot . '/message/output/airnotifier/externallib.php'); } diff --git a/message/output/airnotifier/tests/privacy_test.php b/message/output/airnotifier/tests/privacy_test.php index 96bd3478801..22cc63d99cb 100644 --- a/message/output/airnotifier/tests/privacy_test.php +++ b/message/output/airnotifier/tests/privacy_test.php @@ -38,7 +38,7 @@ class message_airnotifier_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/message/output/email/tests/privacy_test.php b/message/output/email/tests/privacy_test.php index dbfd9ba18a0..700c919bfc1 100644 --- a/message/output/email/tests/privacy_test.php +++ b/message/output/email/tests/privacy_test.php @@ -34,7 +34,7 @@ class message_email_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/message/output/jabber/tests/privacy_test.php b/message/output/jabber/tests/privacy_test.php index 99e16cf8e48..1475b275a05 100644 --- a/message/output/jabber/tests/privacy_test.php +++ b/message/output/jabber/tests/privacy_test.php @@ -36,7 +36,7 @@ class message_jabber_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/message/output/popup/tests/api_test.php b/message/output/popup/tests/api_test.php index 1d51f6a44fa..069e5f6cbd5 100644 --- a/message/output/popup/tests/api_test.php +++ b/message/output/popup/tests/api_test.php @@ -46,7 +46,7 @@ class message_popup_api_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->preventResetByRollback(); // Messaging is not compatible with transactions. $this->messagesink = $this->redirectMessages(); $this->resetAfterTest(); diff --git a/message/output/popup/tests/externallib_test.php b/message/output/popup/tests/externallib_test.php index 94fe0dbc42a..26da55f692c 100644 --- a/message/output/popup/tests/externallib_test.php +++ b/message/output/popup/tests/externallib_test.php @@ -44,7 +44,7 @@ class message_popup_externallib_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->preventResetByRollback(); // Messaging is not compatible with transactions. $this->messagesink = $this->redirectMessages(); $this->resetAfterTest(); diff --git a/message/tests/events_test.php b/message/tests/events_test.php index 00a6b19fae2..0ec24ea9c5d 100644 --- a/message/tests/events_test.php +++ b/message/tests/events_test.php @@ -44,7 +44,7 @@ class core_message_events_testcase extends core_message_messagelib_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/message/tests/externallib_test.php b/message/tests/externallib_test.php index 4fd7e6ea49d..c21c311fdc8 100644 --- a/message/tests/externallib_test.php +++ b/message/tests/externallib_test.php @@ -37,7 +37,7 @@ class core_message_externallib_testcase extends externallib_advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { global $CFG; require_once($CFG->dirroot . '/message/lib.php'); diff --git a/message/tests/helper_test.php b/message/tests/helper_test.php index 7b27d56ba1f..2bfa83e0986 100644 --- a/message/tests/helper_test.php +++ b/message/tests/helper_test.php @@ -39,7 +39,7 @@ require_once($CFG->dirroot . '/message/tests/messagelib_test.php'); */ class core_message_helper_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/message/tests/inbound_test.php b/message/tests/inbound_test.php index e07b2f78c59..6db7eb4ab66 100644 --- a/message/tests/inbound_test.php +++ b/message/tests/inbound_test.php @@ -38,7 +38,7 @@ class core_message_inbound_testcase extends advanced_testcase { * This includes: * * configuring the messageinbound_mailbox. */ - public function setUp() { + public function setUp(): void { global $CFG; $this->resetAfterTest(true); diff --git a/message/tests/messagelib_test.php b/message/tests/messagelib_test.php index 5a75739fffd..7d195e7e1af 100644 --- a/message/tests/messagelib_test.php +++ b/message/tests/messagelib_test.php @@ -48,7 +48,7 @@ class core_message_messagelib_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->preventResetByRollback(); // Messaging is not compatible with transactions. $this->messagesink = $this->redirectMessages(); $this->resetAfterTest(); diff --git a/message/tests/migrate_message_data_task_test.php b/message/tests/migrate_message_data_task_test.php index a480e70e213..704396b669d 100644 --- a/message/tests/migrate_message_data_task_test.php +++ b/message/tests/migrate_message_data_task_test.php @@ -44,7 +44,7 @@ class core_message_migrate_message_data_task_testcase extends advanced_testcase * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/message/tests/search_received_test.php b/message/tests/search_received_test.php index c8f53ac366e..7e59a281eb8 100644 --- a/message/tests/search_received_test.php +++ b/message/tests/search_received_test.php @@ -45,7 +45,7 @@ class message_received_search_testcase extends advanced_testcase { * Setting up the test environment * @return void */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); set_config('enableglobalsearch', true); diff --git a/message/tests/search_sent_test.php b/message/tests/search_sent_test.php index eb42216cb2e..91a0a6e4668 100644 --- a/message/tests/search_sent_test.php +++ b/message/tests/search_sent_test.php @@ -45,7 +45,7 @@ class message_sent_search_testcase extends advanced_testcase { * Setting up the test environment * @return void */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); set_config('enableglobalsearch', true); diff --git a/mnet/service/enrol/tests/privacy_test.php b/mnet/service/enrol/tests/privacy_test.php index 005e0e38b0f..795ec779845 100644 --- a/mnet/service/enrol/tests/privacy_test.php +++ b/mnet/service/enrol/tests/privacy_test.php @@ -51,7 +51,7 @@ class mnetservice_enrol_privacy_testcase extends provider_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { global $DB; // Add a mnet host. @@ -340,4 +340,4 @@ class mnetservice_enrol_privacy_testcase extends provider_testcase { $course->rolename = 'student'; $DB->insert_record('mnetservice_enrol_courses', $course); } -} \ No newline at end of file +} diff --git a/mnet/tests/events_test.php b/mnet/tests/events_test.php index 451a1c6085f..599342bdeb4 100644 --- a/mnet/tests/events_test.php +++ b/mnet/tests/events_test.php @@ -39,7 +39,7 @@ class mnet_events_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/mod/assign/feedback/editpdf/tests/privacy_test.php b/mod/assign/feedback/editpdf/tests/privacy_test.php index af07abe51b9..cfd355eb84a 100644 --- a/mod/assign/feedback/editpdf/tests/privacy_test.php +++ b/mod/assign/feedback/editpdf/tests/privacy_test.php @@ -39,7 +39,7 @@ use \mod_assign\privacy\assign_plugin_request_data; */ class assignfeedback_editpdf_privacy_testcase extends \mod_assign\tests\mod_assign_privacy_testcase { - public function setUp() { + public function setUp(): void { // Skip this test if ghostscript is not supported. $result = \assignfeedback_editpdf\pdf::test_gs_path(false); if ($result->status !== \assignfeedback_editpdf\pdf::GSPATH_OK) { diff --git a/mod/assign/tests/base_test.php b/mod/assign/tests/base_test.php index d30f98986c5..3212fe37697 100644 --- a/mod/assign/tests/base_test.php +++ b/mod/assign/tests/base_test.php @@ -86,7 +86,7 @@ class mod_assign_base_testcase extends advanced_testcase { /** * Setup function - we will create a course and add an assign instance to it. */ - protected function setUp() { + protected function setUp(): void { global $DB; $this->resetAfterTest(true); diff --git a/mod/book/tests/events_test.php b/mod/book/tests/events_test.php index cd95aea24e3..dbda1846621 100644 --- a/mod/book/tests/events_test.php +++ b/mod/book/tests/events_test.php @@ -36,7 +36,7 @@ global $CFG; */ class mod_book_events_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/book/tests/lib_test.php b/mod/book/tests/lib_test.php index 247f29dda93..283997673f5 100644 --- a/mod/book/tests/lib_test.php +++ b/mod/book/tests/lib_test.php @@ -39,7 +39,7 @@ require_once($CFG->dirroot . '/mod/book/lib.php'); */ class mod_book_lib_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); } diff --git a/mod/book/tests/search_test.php b/mod/book/tests/search_test.php index 65e15896ba3..03bfd1e05d3 100644 --- a/mod/book/tests/search_test.php +++ b/mod/book/tests/search_test.php @@ -43,7 +43,7 @@ class mod_book_search_testcase extends advanced_testcase { */ protected $bookchapterareaid = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); set_config('enableglobalsearch', true); diff --git a/mod/book/tool/exportimscp/tests/events_test.php b/mod/book/tool/exportimscp/tests/events_test.php index 3132a41fb0e..91e16c70ce8 100644 --- a/mod/book/tool/exportimscp/tests/events_test.php +++ b/mod/book/tool/exportimscp/tests/events_test.php @@ -36,7 +36,7 @@ global $CFG; */ class booktool_exportimscp_events_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/book/tool/importhtml/tests/locallib_test.php b/mod/book/tool/importhtml/tests/locallib_test.php index 1ab755f4ac9..d0ccb051c95 100644 --- a/mod/book/tool/importhtml/tests/locallib_test.php +++ b/mod/book/tool/importhtml/tests/locallib_test.php @@ -38,7 +38,7 @@ require_once($CFG->dirroot.'/mod/book/tool/importhtml/locallib.php'); */ class booktool_importhtml_locallib_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/book/tool/print/tests/events_test.php b/mod/book/tool/print/tests/events_test.php index da071e58bb1..23c8a411bfa 100644 --- a/mod/book/tool/print/tests/events_test.php +++ b/mod/book/tool/print/tests/events_test.php @@ -36,7 +36,7 @@ global $CFG; */ class booktool_print_events_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/chat/tests/lib_test.php b/mod/chat/tests/lib_test.php index 7a864cfecb3..14cf9852bed 100644 --- a/mod/chat/tests/lib_test.php +++ b/mod/chat/tests/lib_test.php @@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die(); */ class mod_chat_lib_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/chat/tests/privacy_test.php b/mod/chat/tests/privacy_test.php index e3b4d9b908c..12669f46b6a 100644 --- a/mod/chat/tests/privacy_test.php +++ b/mod/chat/tests/privacy_test.php @@ -47,7 +47,7 @@ require_once($CFG->dirroot . '/mod/chat/lib.php'); */ class mod_chat_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { global $PAGE; $this->resetAfterTest(); $PAGE->get_renderer('core'); diff --git a/mod/choice/tests/events_test.php b/mod/choice/tests/events_test.php index 41fb362ab11..c12258208b4 100644 --- a/mod/choice/tests/events_test.php +++ b/mod/choice/tests/events_test.php @@ -50,7 +50,7 @@ class mod_choice_events_testcase extends advanced_testcase { /** * Setup often used objects for the following tests. */ - protected function setup() { + protected function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/mod/choice/tests/privacy_provider_test.php b/mod/choice/tests/privacy_provider_test.php index e076cf98418..517d27bac42 100644 --- a/mod/choice/tests/privacy_provider_test.php +++ b/mod/choice/tests/privacy_provider_test.php @@ -48,7 +48,7 @@ class mod_choice_privacy_provider_testcase extends \core_privacy\tests\provider_ /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); global $DB; diff --git a/mod/data/tests/events_test.php b/mod/data/tests/events_test.php index 272d3a01aa7..9835201886f 100644 --- a/mod/data/tests/events_test.php +++ b/mod/data/tests/events_test.php @@ -34,7 +34,7 @@ class mod_data_events_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/data/tests/externallib_test.php b/mod/data/tests/externallib_test.php index c49c9be96fb..815744c5b60 100644 --- a/mod/data/tests/externallib_test.php +++ b/mod/data/tests/externallib_test.php @@ -83,7 +83,7 @@ class mod_data_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/data/tests/import_test.php b/mod/data/tests/import_test.php index ab5c826d881..aaa45572dbd 100644 --- a/mod/data/tests/import_test.php +++ b/mod/data/tests/import_test.php @@ -37,7 +37,7 @@ class mod_data_import_test extends advanced_testcase { /** * Set up function. */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); global $CFG; diff --git a/mod/data/tests/lib_test.php b/mod/data/tests/lib_test.php index 84e8a7b4470..ef43165c113 100644 --- a/mod/data/tests/lib_test.php +++ b/mod/data/tests/lib_test.php @@ -45,7 +45,7 @@ class mod_data_lib_testcase extends advanced_testcase { /** * Tear Down to reset DB. */ - public function tearDown() { + public function tearDown(): void { global $DB; if (isset($this->DB)) { diff --git a/mod/data/tests/privacy_provider_test.php b/mod/data/tests/privacy_provider_test.php index 31d7c7bee80..c2b8ea39b70 100644 --- a/mod/data/tests/privacy_provider_test.php +++ b/mod/data/tests/privacy_provider_test.php @@ -52,7 +52,7 @@ class mod_data_privacy_provider_testcase extends \core_privacy\tests\provider_te /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); global $DB; diff --git a/mod/data/tests/search_test.php b/mod/data/tests/search_test.php index 8988ea67074..ceab97ed023 100644 --- a/mod/data/tests/search_test.php +++ b/mod/data/tests/search_test.php @@ -101,7 +101,7 @@ class mod_data_search_test extends advanced_testcase { * Set up function. In this instance we are setting up database * records to be used in the unit tests. */ - protected function setUp() { + protected function setUp(): void { global $DB, $CFG; parent::setUp(); diff --git a/mod/feedback/tests/events_test.php b/mod/feedback/tests/events_test.php index 4d6fe2318af..7d6382f2eb5 100644 --- a/mod/feedback/tests/events_test.php +++ b/mod/feedback/tests/events_test.php @@ -56,7 +56,7 @@ class mod_feedback_events_testcase extends advanced_testcase { /** @var stdClass value associated with $eventfeedbackitem . */ private $eventfeedbackvalue; - public function setUp() { + public function setUp(): void { global $DB; $this->setAdminUser(); diff --git a/mod/feedback/tests/external_test.php b/mod/feedback/tests/external_test.php index d920b9b84ac..8f4c715b826 100644 --- a/mod/feedback/tests/external_test.php +++ b/mod/feedback/tests/external_test.php @@ -47,7 +47,7 @@ class mod_feedback_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/feedback/tests/privacy_test.php b/mod/feedback/tests/privacy_test.php index 248eef8d640..068a1eafb9a 100644 --- a/mod/feedback/tests/privacy_test.php +++ b/mod/feedback/tests/privacy_test.php @@ -46,7 +46,7 @@ require_once($CFG->dirroot . '/mod/feedback/lib.php'); */ class mod_feedback_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/folder/tests/events_test.php b/mod/folder/tests/events_test.php index 71723dc7e12..c14bb5331bc 100644 --- a/mod/folder/tests/events_test.php +++ b/mod/folder/tests/events_test.php @@ -30,7 +30,7 @@ class mod_folder_events_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/folder/tests/lib_test.php b/mod/folder/tests/lib_test.php index 5a42f632fcc..9ee17e68694 100644 --- a/mod/folder/tests/lib_test.php +++ b/mod/folder/tests/lib_test.php @@ -41,7 +41,7 @@ class mod_folder_lib_testcase extends advanced_testcase { /** * Setup. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); } @@ -50,7 +50,7 @@ class mod_folder_lib_testcase extends advanced_testcase { * Prepares things before this test case is initialised * @return void */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/mod/folder/lib.php'); } diff --git a/mod/folder/tests/search_test.php b/mod/folder/tests/search_test.php index 0c9f751fcb7..905f225f2a2 100644 --- a/mod/folder/tests/search_test.php +++ b/mod/folder/tests/search_test.php @@ -43,7 +43,7 @@ class mod_folder_search_testcase extends advanced_testcase { */ protected $folderareaid = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); set_config('enableglobalsearch', true); diff --git a/mod/forum/tests/builders_exported_posts_test.php b/mod/forum/tests/builders_exported_posts_test.php index a8875bb3c0b..f740ffbb81a 100644 --- a/mod/forum/tests/builders_exported_posts_test.php +++ b/mod/forum/tests/builders_exported_posts_test.php @@ -43,7 +43,7 @@ class mod_forum_builders_exported_posts_testcase extends advanced_testcase { /** * Set up function for tests. */ - public function setUp() { + public function setUp(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); @@ -55,7 +55,7 @@ class mod_forum_builders_exported_posts_testcase extends advanced_testcase { /** * Tear down function for tests. */ - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/events_test.php b/mod/forum/tests/events_test.php index bf54d50d640..01b203ae8e7 100644 --- a/mod/forum/tests/events_test.php +++ b/mod/forum/tests/events_test.php @@ -38,7 +38,7 @@ class mod_forum_events_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); @@ -46,7 +46,7 @@ class mod_forum_events_testcase extends advanced_testcase { $this->resetAfterTest(); } - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/exporters_discussion_test.php b/mod/forum/tests/exporters_discussion_test.php index 7290395fc85..d31d1499a49 100644 --- a/mod/forum/tests/exporters_discussion_test.php +++ b/mod/forum/tests/exporters_discussion_test.php @@ -38,7 +38,7 @@ class mod_forum_exporters_discussion_testcase extends advanced_testcase { /** * Test set up function. */ - public function setUp() { + public function setUp(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); @@ -50,7 +50,7 @@ class mod_forum_exporters_discussion_testcase extends advanced_testcase { /** * Test tear down function. */ - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/externallib_test.php b/mod/forum/tests/externallib_test.php index 2430f272e58..ed523db9168 100644 --- a/mod/forum/tests/externallib_test.php +++ b/mod/forum/tests/externallib_test.php @@ -35,7 +35,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase { /** * Tests set up */ - protected function setUp() { + protected function setUp(): void { global $CFG; // We must clear the subscription caches. This has to be done both before each test, and after in case of other @@ -45,7 +45,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase { require_once($CFG->dirroot . '/mod/forum/externallib.php'); } - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/generator_test.php b/mod/forum/tests/generator_test.php index 8a4e20fc403..0031d05a331 100644 --- a/mod/forum/tests/generator_test.php +++ b/mod/forum/tests/generator_test.php @@ -36,13 +36,13 @@ defined('MOODLE_INTERNAL') || die(); */ class mod_forum_generator_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); } - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/lib_test.php b/mod/forum/tests/lib_test.php index 1cf30d536c8..e0635e89780 100644 --- a/mod/forum/tests/lib_test.php +++ b/mod/forum/tests/lib_test.php @@ -31,13 +31,13 @@ require_once($CFG->dirroot . '/rating/lib.php'); class mod_forum_lib_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); } - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/mail_group_test.php b/mod/forum/tests/mail_group_test.php index 904151f01cd..f7e24390d59 100644 --- a/mod/forum/tests/mail_group_test.php +++ b/mod/forum/tests/mail_group_test.php @@ -52,7 +52,7 @@ class mod_forum_mail_group_testcase extends advanced_testcase { */ protected $mailsink; - public function setUp() { + public function setUp(): void { global $CFG; // We must clear the subscription caches. This has to be done both before each test, and after in case of other @@ -72,7 +72,7 @@ class mod_forum_mail_group_testcase extends advanced_testcase { $CFG->maxeditingtime = -1; } - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/mail_test.php b/mod/forum/tests/mail_test.php index 9902a29c0ec..26dc9d1554b 100644 --- a/mod/forum/tests/mail_test.php +++ b/mod/forum/tests/mail_test.php @@ -47,7 +47,7 @@ class mod_forum_mail_testcase extends advanced_testcase { */ protected $mailsink; - public function setUp() { + public function setUp(): void { global $CFG; // We must clear the subscription caches. This has to be done both before each test, and after in case of other @@ -67,7 +67,7 @@ class mod_forum_mail_testcase extends advanced_testcase { $CFG->maxeditingtime = -1; } - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/maildigest_test.php b/mod/forum/tests/maildigest_test.php index efd8019c6e2..0bcae0f98ec 100644 --- a/mod/forum/tests/maildigest_test.php +++ b/mod/forum/tests/maildigest_test.php @@ -41,7 +41,7 @@ class mod_forum_maildigest_testcase extends advanced_testcase { * Set up message and mail sinks, and set up other requirements for the * cron to be tested here. */ - public function setUp() { + public function setUp(): void { global $CFG; // Messaging is not compatible with transactions... @@ -78,7 +78,7 @@ class mod_forum_maildigest_testcase extends advanced_testcase { /** * Clear the message sinks set up in this test. */ - public function tearDown() { + public function tearDown(): void { $this->messagesink->clear(); $this->messagesink->close(); diff --git a/mod/forum/tests/managers_capability_test.php b/mod/forum/tests/managers_capability_test.php index d0064df2588..a5301839d0c 100644 --- a/mod/forum/tests/managers_capability_test.php +++ b/mod/forum/tests/managers_capability_test.php @@ -81,7 +81,7 @@ class mod_forum_managers_capability_testcase extends advanced_testcase { /** * Setup function before each test. */ - public function setUp() { + public function setUp(): void { global $DB; // We must clear the subscription caches. This has to be done both before each test, and after in case of other @@ -113,7 +113,7 @@ class mod_forum_managers_capability_testcase extends advanced_testcase { /** * Tear down function after each test. */ - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/privacy_provider_test.php b/mod/forum/tests/privacy_provider_test.php index ac7ff4ed39c..047849eec13 100644 --- a/mod/forum/tests/privacy_provider_test.php +++ b/mod/forum/tests/privacy_provider_test.php @@ -56,7 +56,7 @@ class mod_forum_privacy_provider_testcase extends \core_privacy\tests\provider_t /** * Test setUp. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/mod/forum/tests/private_replies_test.php b/mod/forum/tests/private_replies_test.php index 27a47ce664b..f22cc7e34ec 100644 --- a/mod/forum/tests/private_replies_test.php +++ b/mod/forum/tests/private_replies_test.php @@ -42,7 +42,7 @@ class private_replies extends advanced_testcase { /** * Setup before tests. */ - public function setUp() { + public function setUp(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); @@ -51,7 +51,7 @@ class private_replies extends advanced_testcase { /** * Tear down after tests. */ - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/qanda_test.php b/mod/forum/tests/qanda_test.php index 3e4795250ab..2710d1bc3c7 100644 --- a/mod/forum/tests/qanda_test.php +++ b/mod/forum/tests/qanda_test.php @@ -52,7 +52,7 @@ class mod_forum_qanda_testcase extends advanced_testcase { */ protected $mailsink; - public function setUp() { + public function setUp(): void { global $CFG; // We must clear the subscription caches. This has to be done both before each test, and after in case of other @@ -72,7 +72,7 @@ class mod_forum_qanda_testcase extends advanced_testcase { $CFG->maxeditingtime = -1; } - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/search_test.php b/mod/forum/tests/search_test.php index 93095aab95e..68d33cad9f9 100644 --- a/mod/forum/tests/search_test.php +++ b/mod/forum/tests/search_test.php @@ -45,7 +45,7 @@ class mod_forum_search_testcase extends advanced_testcase { */ protected $forumpostareaid = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); set_config('enableglobalsearch', true); diff --git a/mod/forum/tests/subscriptions_test.php b/mod/forum/tests/subscriptions_test.php index df894958ce7..44595635e81 100644 --- a/mod/forum/tests/subscriptions_test.php +++ b/mod/forum/tests/subscriptions_test.php @@ -36,7 +36,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { /** * Test setUp. */ - public function setUp() { + public function setUp(): void { global $DB; // We must clear the subscription caches. This has to be done both before each test, and after in case of other @@ -48,7 +48,7 @@ class mod_forum_subscriptions_testcase extends advanced_testcase { /** * Test tearDown. */ - public function tearDown() { + public function tearDown(): void { // We must clear the subscription caches. This has to be done both before each test, and after in case of other // tests using these functions. \mod_forum\subscriptions::reset_forum_cache(); diff --git a/mod/forum/tests/vaults_discussion_list_test.php b/mod/forum/tests/vaults_discussion_list_test.php index cac34353532..68bdabe241a 100644 --- a/mod/forum/tests/vaults_discussion_list_test.php +++ b/mod/forum/tests/vaults_discussion_list_test.php @@ -46,7 +46,7 @@ class mod_forum_vaults_discussion_list_testcase extends advanced_testcase { /** * Set up function for tests. */ - public function setUp() { + public function setUp(): void { $vaultfactory = \mod_forum\local\container::get_vault_factory(); $this->vault = $vaultfactory->get_discussions_in_forum_vault(); } diff --git a/mod/forum/tests/vaults_discussion_test.php b/mod/forum/tests/vaults_discussion_test.php index 3a575d939a0..3b27cc9f392 100644 --- a/mod/forum/tests/vaults_discussion_test.php +++ b/mod/forum/tests/vaults_discussion_test.php @@ -43,7 +43,7 @@ class mod_forum_vaults_discussion_testcase extends advanced_testcase { /** * Set up function for tests. */ - public function setUp() { + public function setUp(): void { $vaultfactory = \mod_forum\local\container::get_vault_factory(); $this->vault = $vaultfactory->get_discussion_vault(); } diff --git a/mod/forum/tests/vaults_post_test.php b/mod/forum/tests/vaults_post_test.php index de7838c0dd2..0057e6047d3 100644 --- a/mod/forum/tests/vaults_post_test.php +++ b/mod/forum/tests/vaults_post_test.php @@ -44,7 +44,7 @@ class mod_forum_vaults_post_testcase extends advanced_testcase { /** * Set up function for tests. */ - public function setUp() { + public function setUp(): void { $vaultfactory = \mod_forum\local\container::get_vault_factory(); $this->vault = $vaultfactory->get_post_vault(); } @@ -52,7 +52,7 @@ class mod_forum_vaults_post_testcase extends advanced_testcase { /** * Teardown for all tests. */ - public function tearDown() { + public function tearDown(): void { unset($this->vault); } diff --git a/mod/glossary/tests/events_test.php b/mod/glossary/tests/events_test.php index d0101555eed..2d30141ab60 100644 --- a/mod/glossary/tests/events_test.php +++ b/mod/glossary/tests/events_test.php @@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die(); */ class glossary_event_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/glossary/tests/privacy_provider_test.php b/mod/glossary/tests/privacy_provider_test.php index d763fc78ac0..6664e2f3b4b 100644 --- a/mod/glossary/tests/privacy_provider_test.php +++ b/mod/glossary/tests/privacy_provider_test.php @@ -58,7 +58,7 @@ class mod_glossary_privacy_provider_testcase extends \core_privacy\tests\provide /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(); global $DB; diff --git a/mod/glossary/tests/search_test.php b/mod/glossary/tests/search_test.php index cf8ddbe04bd..b8f7bc64d52 100644 --- a/mod/glossary/tests/search_test.php +++ b/mod/glossary/tests/search_test.php @@ -44,7 +44,7 @@ class mod_glossary_search_testcase extends advanced_testcase { */ protected $entryareaid = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); set_config('enableglobalsearch', true); diff --git a/mod/label/tests/lib_test.php b/mod/label/tests/lib_test.php index 20d581641ee..649fafd3320 100644 --- a/mod/label/tests/lib_test.php +++ b/mod/label/tests/lib_test.php @@ -39,7 +39,7 @@ class mod_label_lib_testcase extends advanced_testcase { /** * Set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); } @@ -234,4 +234,4 @@ class mod_label_lib_testcase extends advanced_testcase { return calendar_event::create($event); } -} \ No newline at end of file +} diff --git a/mod/lesson/tests/events_test.php b/mod/lesson/tests/events_test.php index cbb1288b931..74526fb661b 100644 --- a/mod/lesson/tests/events_test.php +++ b/mod/lesson/tests/events_test.php @@ -42,7 +42,7 @@ class mod_lesson_events_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/lesson/tests/external_test.php b/mod/lesson/tests/external_test.php index 95246491516..a34be9b77ae 100644 --- a/mod/lesson/tests/external_test.php +++ b/mod/lesson/tests/external_test.php @@ -69,7 +69,7 @@ class mod_lesson_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/lesson/tests/privacy_test.php b/mod/lesson/tests/privacy_test.php index 0cd6c23a49f..12aa9b6c5cf 100644 --- a/mod/lesson/tests/privacy_test.php +++ b/mod/lesson/tests/privacy_test.php @@ -44,7 +44,7 @@ use mod_lesson\privacy\provider; */ class mod_lesson_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { global $PAGE; $this->setAdminUser(); // The data generator complains without this. $this->resetAfterTest(); diff --git a/mod/lti/service/gradebookservices/tests/privacy_provider_test.php b/mod/lti/service/gradebookservices/tests/privacy_provider_test.php index d24c59c8f12..0f75ec201b3 100644 --- a/mod/lti/service/gradebookservices/tests/privacy_provider_test.php +++ b/mod/lti/service/gradebookservices/tests/privacy_provider_test.php @@ -36,7 +36,7 @@ class ltiservice_gradebookservices_privacy_provider_testcase extends provider_te /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/mod/lti/service/gradebookservices/tests/task_cleanup_test.php b/mod/lti/service/gradebookservices/tests/task_cleanup_test.php index c9ed00414b6..489aff04c6e 100644 --- a/mod/lti/service/gradebookservices/tests/task_cleanup_test.php +++ b/mod/lti/service/gradebookservices/tests/task_cleanup_test.php @@ -40,7 +40,7 @@ class ltiservice_gradebookservices_cleanup_task_testcase extends advanced_testca * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/lti/service/memberships/tests/privacy_provider_test.php b/mod/lti/service/memberships/tests/privacy_provider_test.php index a2e8d87e623..89886741771 100644 --- a/mod/lti/service/memberships/tests/privacy_provider_test.php +++ b/mod/lti/service/memberships/tests/privacy_provider_test.php @@ -36,7 +36,7 @@ class ltiservice_memberships_privacy_provider_testcase extends provider_testcase /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/mod/lti/tests/externallib_test.php b/mod/lti/tests/externallib_test.php index f56dc8330e2..f9f72f50430 100644 --- a/mod/lti/tests/externallib_test.php +++ b/mod/lti/tests/externallib_test.php @@ -45,7 +45,7 @@ class mod_lti_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/lti/tests/lib_test.php b/mod/lti/tests/lib_test.php index 564b5cff869..71d1e23fed0 100644 --- a/mod/lti/tests/lib_test.php +++ b/mod/lti/tests/lib_test.php @@ -41,7 +41,7 @@ class mod_lti_lib_testcase extends advanced_testcase { * Prepares things before this test case is initialised * @return void */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/mod/lti/lib.php'); } diff --git a/mod/lti/tests/task_clean_access_tokens_test.php b/mod/lti/tests/task_clean_access_tokens_test.php index 5af37f08204..df063ce7f9a 100644 --- a/mod/lti/tests/task_clean_access_tokens_test.php +++ b/mod/lti/tests/task_clean_access_tokens_test.php @@ -40,7 +40,7 @@ class mod_lti_clean_access_tokens_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/page/tests/lib_test.php b/mod/page/tests/lib_test.php index e93d723f6c0..2932d159027 100644 --- a/mod/page/tests/lib_test.php +++ b/mod/page/tests/lib_test.php @@ -42,7 +42,7 @@ class mod_page_lib_testcase extends advanced_testcase { * Prepares things before this test case is initialised * @return void */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/mod/page/lib.php'); } diff --git a/mod/quiz/accessrule/seb/tests/access_manager_test.php b/mod/quiz/accessrule/seb/tests/access_manager_test.php index eefa5b95f7b..6952ec010ce 100644 --- a/mod/quiz/accessrule/seb/tests/access_manager_test.php +++ b/mod/quiz/accessrule/seb/tests/access_manager_test.php @@ -43,7 +43,7 @@ class quizacces_seb_access_manager_testcase extends advanced_testcase { /** * Called before every test. */ - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); diff --git a/mod/quiz/accessrule/seb/tests/backup_restore_test.php b/mod/quiz/accessrule/seb/tests/backup_restore_test.php index dc01aa3faa1..049ea298d0e 100644 --- a/mod/quiz/accessrule/seb/tests/backup_restore_test.php +++ b/mod/quiz/accessrule/seb/tests/backup_restore_test.php @@ -44,7 +44,7 @@ class quizaccess_seb_backup_restore_testcase extends advanced_testcase { /** * Called before every test. */ - public function setUp() { + public function setUp(): void { global $USER; parent::setUp(); diff --git a/mod/quiz/accessrule/seb/tests/event_test.php b/mod/quiz/accessrule/seb/tests/event_test.php index 354b310649f..ab4ef7afe99 100644 --- a/mod/quiz/accessrule/seb/tests/event_test.php +++ b/mod/quiz/accessrule/seb/tests/event_test.php @@ -40,7 +40,7 @@ class quizaccess_seb_event_testcase extends advanced_testcase { /** * Called before every test. */ - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); @@ -128,4 +128,4 @@ class quizaccess_seb_event_testcase extends advanced_testcase { $this->assertEquals($user->id, $event->userid); $this->assertEquals($template->get('id'), $event->objectid); } -} \ No newline at end of file +} diff --git a/mod/quiz/accessrule/seb/tests/link_generator_test.php b/mod/quiz/accessrule/seb/tests/link_generator_test.php index aa2091e8488..6d61979a706 100644 --- a/mod/quiz/accessrule/seb/tests/link_generator_test.php +++ b/mod/quiz/accessrule/seb/tests/link_generator_test.php @@ -38,7 +38,7 @@ class quizaccess_seb_link_generator_testcase extends advanced_testcase { /** * Called before every test. */ - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); } diff --git a/mod/quiz/accessrule/seb/tests/quiz_settings_test.php b/mod/quiz/accessrule/seb/tests/quiz_settings_test.php index d01b7e556a8..1e7c3946ec3 100644 --- a/mod/quiz/accessrule/seb/tests/quiz_settings_test.php +++ b/mod/quiz/accessrule/seb/tests/quiz_settings_test.php @@ -48,7 +48,7 @@ class quizaccess_seb_quiz_settings_testcase extends advanced_testcase { /** * Called before every test. */ - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); diff --git a/mod/quiz/accessrule/seb/tests/rule_test.php b/mod/quiz/accessrule/seb/tests/rule_test.php index a7db893d6c0..89c408e7036 100644 --- a/mod/quiz/accessrule/seb/tests/rule_test.php +++ b/mod/quiz/accessrule/seb/tests/rule_test.php @@ -42,7 +42,7 @@ class quizaccess_seb_rule__testcase extends advanced_testcase { /** * Called before every test. */ - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); @@ -84,7 +84,7 @@ class quizaccess_seb_rule__testcase extends advanced_testcase { */ public function valid_form_data_provider() : array { return [ - 'valid seb_requiresafeexambrowser' => ['seb_requiresafeexambrowser', 0], + 'valid seb_requiresafeexambrowser' => ['seb_requiresafeexambrowser', '0'], 'valid seb_linkquitseb0' => ['seb_linkquitseb', 'http://safeexambrowser.org/macosx'], 'valid seb_linkquitseb1' => ['seb_linkquitseb', 'safeexambrowser.org/macosx'], 'valid seb_linkquitseb2' => ['seb_linkquitseb', 'www.safeexambrowser.org/macosx'], diff --git a/mod/quiz/accessrule/seb/tests/template_test.php b/mod/quiz/accessrule/seb/tests/template_test.php index 9cbb5588281..0be6b6d4fa0 100644 --- a/mod/quiz/accessrule/seb/tests/template_test.php +++ b/mod/quiz/accessrule/seb/tests/template_test.php @@ -38,7 +38,7 @@ class quizaccess_seb_template_testcase extends advanced_testcase { /** * Called before every test. */ - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(); diff --git a/mod/quiz/tests/external_test.php b/mod/quiz/tests/external_test.php index 6de933da16f..0ea6a4eda6f 100644 --- a/mod/quiz/tests/external_test.php +++ b/mod/quiz/tests/external_test.php @@ -77,7 +77,7 @@ class mod_quiz_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/quiz/tests/repaginate_test.php b/mod/quiz/tests/repaginate_test.php index f82c20cd0d1..9623b5d9bbf 100644 --- a/mod/quiz/tests/repaginate_test.php +++ b/mod/quiz/tests/repaginate_test.php @@ -68,12 +68,12 @@ class mod_quiz_repaginate_test extends advanced_testcase { /** @var mod_quiz_repaginate_testable the object being tested. */ private $repaginate = null; - public function setUp() { + public function setUp(): void { $this->set_quiz_slots($this->get_quiz_object()->get_slots()); $this->repaginate = new mod_quiz_repaginate_testable(0, $this->quizslots); } - public function tearDown() { + public function tearDown(): void { $this->repaginate = null; } diff --git a/mod/resource/tests/events_test.php b/mod/resource/tests/events_test.php index da21c0551a2..44f10c2f43e 100644 --- a/mod/resource/tests/events_test.php +++ b/mod/resource/tests/events_test.php @@ -36,7 +36,7 @@ class mod_resource_events_testcase extends advanced_testcase { /** * Setup is called before calling test case. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); // Must be a non-guest user to create resources. diff --git a/mod/resource/tests/lib_test.php b/mod/resource/tests/lib_test.php index 787b815bbbf..d1de43cfca6 100644 --- a/mod/resource/tests/lib_test.php +++ b/mod/resource/tests/lib_test.php @@ -42,7 +42,7 @@ class mod_resource_lib_testcase extends advanced_testcase { * Prepares things before this test case is initialised * @return void */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/mod/resource/lib.php'); } diff --git a/mod/resource/tests/search_test.php b/mod/resource/tests/search_test.php index c5d04dd3884..d52b96c4a19 100644 --- a/mod/resource/tests/search_test.php +++ b/mod/resource/tests/search_test.php @@ -43,7 +43,7 @@ class mod_resource_search_testcase extends advanced_testcase { */ protected $resourceareaid = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); set_config('enableglobalsearch', true); diff --git a/mod/scorm/report/basic/tests/privacy_test.php b/mod/scorm/report/basic/tests/privacy_test.php index ff06ce57658..0a57cbe1dbf 100644 --- a/mod/scorm/report/basic/tests/privacy_test.php +++ b/mod/scorm/report/basic/tests/privacy_test.php @@ -39,7 +39,7 @@ class scormreport_basic_privacy_testcase extends \core_privacy\tests\provider_te /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/mod/scorm/report/interactions/tests/privacy_test.php b/mod/scorm/report/interactions/tests/privacy_test.php index 80c63d2ce46..1e6951367bf 100644 --- a/mod/scorm/report/interactions/tests/privacy_test.php +++ b/mod/scorm/report/interactions/tests/privacy_test.php @@ -39,7 +39,7 @@ class scormreport_interactions_privacy_testcase extends \core_privacy\tests\prov /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/mod/scorm/report/objectives/tests/privacy_test.php b/mod/scorm/report/objectives/tests/privacy_test.php index 90ae77e8eb7..148598145b1 100644 --- a/mod/scorm/report/objectives/tests/privacy_test.php +++ b/mod/scorm/report/objectives/tests/privacy_test.php @@ -39,7 +39,7 @@ class scormreport_objectives_privacy_testcase extends \core_privacy\tests\provid /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/mod/scorm/tests/events_test.php b/mod/scorm/tests/events_test.php index bf44adf56bf..24e41b295a6 100644 --- a/mod/scorm/tests/events_test.php +++ b/mod/scorm/tests/events_test.php @@ -47,7 +47,7 @@ class mod_scorm_event_testcase extends advanced_testcase { /** @var stdClass store course module object */ protected $eventcm; - protected function setUp() { + protected function setUp(): void { $this->setAdminUser(); $this->eventcourse = $this->getDataGenerator()->create_course(); $this->eventuser = $this->getDataGenerator()->create_user(); diff --git a/mod/scorm/tests/externallib_test.php b/mod/scorm/tests/externallib_test.php index b6ac0fddf75..79d8f529753 100644 --- a/mod/scorm/tests/externallib_test.php +++ b/mod/scorm/tests/externallib_test.php @@ -45,7 +45,7 @@ class mod_scorm_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB, $CFG; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/scorm/tests/lib_test.php b/mod/scorm/tests/lib_test.php index bc6971f34fe..55e3d198ab2 100644 --- a/mod/scorm/tests/lib_test.php +++ b/mod/scorm/tests/lib_test.php @@ -45,7 +45,7 @@ class mod_scorm_lib_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/scorm/tests/locallib_test.php b/mod/scorm/tests/locallib_test.php index f33791ed56d..ae0ebbb6f10 100644 --- a/mod/scorm/tests/locallib_test.php +++ b/mod/scorm/tests/locallib_test.php @@ -39,7 +39,7 @@ require_once($CFG->dirroot . '/mod/scorm/lib.php'); */ class mod_scorm_locallib_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/survey/tests/events_test.php b/mod/survey/tests/events_test.php index 433b4d3f715..32020269802 100644 --- a/mod/survey/tests/events_test.php +++ b/mod/survey/tests/events_test.php @@ -36,7 +36,7 @@ class mod_survey_events_testcase extends advanced_testcase { /** * Setup. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/mod/survey/tests/externallib_test.php b/mod/survey/tests/externallib_test.php index 30de66b68ec..1a086ac8ac1 100644 --- a/mod/survey/tests/externallib_test.php +++ b/mod/survey/tests/externallib_test.php @@ -45,7 +45,7 @@ class mod_survey_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/survey/tests/lib_test.php b/mod/survey/tests/lib_test.php index 069e88d7acd..43c682a15ca 100644 --- a/mod/survey/tests/lib_test.php +++ b/mod/survey/tests/lib_test.php @@ -42,7 +42,7 @@ class mod_survey_lib_testcase extends advanced_testcase { * Prepares things before this test case is initialised * @return void */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/mod/survey/lib.php'); } diff --git a/mod/survey/tests/privacy_test.php b/mod/survey/tests/privacy_test.php index 75ea2f2fe0a..95f887e54bd 100644 --- a/mod/survey/tests/privacy_test.php +++ b/mod/survey/tests/privacy_test.php @@ -47,7 +47,7 @@ require_once($CFG->dirroot . '/mod/survey/lib.php'); */ class mod_survey_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { global $PAGE; $this->resetAfterTest(); $PAGE->get_renderer('core'); diff --git a/mod/url/tests/lib_test.php b/mod/url/tests/lib_test.php index 50198f03e81..fb0c7f0f041 100644 --- a/mod/url/tests/lib_test.php +++ b/mod/url/tests/lib_test.php @@ -40,7 +40,7 @@ class mod_url_lib_testcase extends advanced_testcase { * Prepares things before this test case is initialised * @return void */ - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; require_once($CFG->dirroot . '/mod/url/lib.php'); require_once($CFG->dirroot . '/mod/url/locallib.php'); @@ -264,4 +264,4 @@ class mod_url_lib_testcase extends advanced_testcase { return calendar_event::create($event); } -} \ No newline at end of file +} diff --git a/mod/wiki/tests/events_test.php b/mod/wiki/tests/events_test.php index b7cf118458c..2714ab263ee 100644 --- a/mod/wiki/tests/events_test.php +++ b/mod/wiki/tests/events_test.php @@ -44,7 +44,7 @@ class mod_wiki_events_testcase extends advanced_testcase { /** * Setup test data. */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/mod/wiki/tests/externallib_test.php b/mod/wiki/tests/externallib_test.php index 522cfbe44a7..c5303cf7d4e 100644 --- a/mod/wiki/tests/externallib_test.php +++ b/mod/wiki/tests/externallib_test.php @@ -45,7 +45,7 @@ class mod_wiki_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/wiki/tests/privacy_test.php b/mod/wiki/tests/privacy_test.php index b2699e46987..e28f6db1588 100644 --- a/mod/wiki/tests/privacy_test.php +++ b/mod/wiki/tests/privacy_test.php @@ -71,7 +71,7 @@ class mod_wiki_privacy_testcase extends provider_testcase { * In the export data they have paths: * $this->pagepaths[1][1], $this->pagepaths[1][2], $this->pagepaths[1][3] */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/mod/wiki/tests/search_test.php b/mod/wiki/tests/search_test.php index 9c3f9078fc6..a7d1171542c 100644 --- a/mod/wiki/tests/search_test.php +++ b/mod/wiki/tests/search_test.php @@ -43,7 +43,7 @@ class mod_wiki_search_testcase extends advanced_testcase { */ protected $wikicollabpageareaid = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); $this->setAdminUser(); set_config('enableglobalsearch', true); diff --git a/mod/workshop/allocation/random/tests/allocator_test.php b/mod/workshop/allocation/random/tests/allocator_test.php index 9beeff1a7dd..f04fc98580e 100644 --- a/mod/workshop/allocation/random/tests/allocator_test.php +++ b/mod/workshop/allocation/random/tests/allocator_test.php @@ -39,7 +39,7 @@ class workshopallocation_random_testcase extends advanced_testcase { /** allocator instance */ protected $allocator; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(); $this->setAdminUser(); @@ -50,7 +50,7 @@ class workshopallocation_random_testcase extends advanced_testcase { $this->allocator = new testable_workshop_random_allocator($this->workshop); } - protected function tearDown() { + protected function tearDown(): void { $this->allocator = null; $this->workshop = null; parent::tearDown(); diff --git a/mod/workshop/eval/best/tests/lib_test.php b/mod/workshop/eval/best/tests/lib_test.php index a11f5bb394a..8a02ca65465 100644 --- a/mod/workshop/eval/best/tests/lib_test.php +++ b/mod/workshop/eval/best/tests/lib_test.php @@ -43,7 +43,7 @@ class workshopeval_best_evaluation_testcase extends advanced_testcase { /** * Setup testing environment */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(); $this->setAdminUser(); @@ -54,7 +54,7 @@ class workshopeval_best_evaluation_testcase extends advanced_testcase { $this->evaluator = new testable_workshop_best_evaluation($this->workshop); } - protected function tearDown() { + protected function tearDown(): void { $this->workshop = null; $this->evaluator = null; parent::tearDown(); diff --git a/mod/workshop/form/accumulative/tests/lib_test.php b/mod/workshop/form/accumulative/tests/lib_test.php index e61d73b0402..42b23e13852 100644 --- a/mod/workshop/form/accumulative/tests/lib_test.php +++ b/mod/workshop/form/accumulative/tests/lib_test.php @@ -41,7 +41,7 @@ class workshop_accumulative_strategy_testcase extends advanced_testcase { /** * Setup testing environment */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(); $this->setAdminUser(); @@ -52,7 +52,7 @@ class workshop_accumulative_strategy_testcase extends advanced_testcase { $this->strategy = new testable_workshop_accumulative_strategy($this->workshop); } - protected function tearDown() { + protected function tearDown(): void { $this->workshop = null; $this->strategy = null; parent::tearDown(); diff --git a/mod/workshop/form/numerrors/tests/lib_test.php b/mod/workshop/form/numerrors/tests/lib_test.php index d350b55dc8f..f11258d01fd 100644 --- a/mod/workshop/form/numerrors/tests/lib_test.php +++ b/mod/workshop/form/numerrors/tests/lib_test.php @@ -43,7 +43,7 @@ class workshopform_numerrors_strategy_testcase extends advanced_testcase { /** * Setup testing environment */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(); $this->setAdminUser(); @@ -54,7 +54,7 @@ class workshopform_numerrors_strategy_testcase extends advanced_testcase { $this->strategy = new testable_workshop_numerrors_strategy($this->workshop); } - protected function tearDown() { + protected function tearDown(): void { $this->workshop = null; $this->strategy = null; parent::tearDown(); diff --git a/mod/workshop/form/rubric/tests/lib_test.php b/mod/workshop/form/rubric/tests/lib_test.php index adb8d663b1c..a83c5de2e54 100644 --- a/mod/workshop/form/rubric/tests/lib_test.php +++ b/mod/workshop/form/rubric/tests/lib_test.php @@ -42,7 +42,7 @@ class workshopform_rubric_strategy_test extends advanced_testcase { /** * Setup testing environment */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(); $this->setAdminUser(); @@ -79,7 +79,7 @@ class workshopform_rubric_strategy_test extends advanced_testcase { } - protected function tearDown() { + protected function tearDown(): void { $this->strategy = null; $this->workshop = null; parent::tearDown(); diff --git a/mod/workshop/tests/events_test.php b/mod/workshop/tests/events_test.php index ea86df9462e..f590bef4b88 100644 --- a/mod/workshop/tests/events_test.php +++ b/mod/workshop/tests/events_test.php @@ -49,7 +49,7 @@ class mod_workshop_events_testcase extends advanced_testcase { /** * Set up the testing environment. */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->setAdminUser(); @@ -60,7 +60,7 @@ class mod_workshop_events_testcase extends advanced_testcase { $this->context = context_module::instance($this->cm->id); } - protected function tearDown() { + protected function tearDown(): void { $this->workshop = null; $this->course = null; $this->cm = null; diff --git a/mod/workshop/tests/external_test.php b/mod/workshop/tests/external_test.php index 1338a51e167..7b5940c35e8 100644 --- a/mod/workshop/tests/external_test.php +++ b/mod/workshop/tests/external_test.php @@ -65,7 +65,7 @@ class mod_workshop_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/workshop/tests/locallib_test.php b/mod/workshop/tests/locallib_test.php index a81ea0f8b1f..0e12a86c73e 100644 --- a/mod/workshop/tests/locallib_test.php +++ b/mod/workshop/tests/locallib_test.php @@ -42,7 +42,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase { protected $workshop; /** setup testing environment */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->setAdminUser(); $this->course = $this->getDataGenerator()->create_course(); @@ -51,7 +51,7 @@ class mod_workshop_internal_api_testcase extends advanced_testcase { $this->workshop = new testable_workshop($workshop, $cm, $this->course); } - protected function tearDown() { + protected function tearDown(): void { $this->workshop = null; parent::tearDown(); } diff --git a/mod/workshop/tests/portfolio_caller_test.php b/mod/workshop/tests/portfolio_caller_test.php index f93805e014c..958694bfbb6 100644 --- a/mod/workshop/tests/portfolio_caller_test.php +++ b/mod/workshop/tests/portfolio_caller_test.php @@ -47,7 +47,7 @@ class mod_workshop_porfolio_caller_testcase extends advanced_testcase { /** * Setup testing environment. */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->setAdminUser(); $course = $this->getDataGenerator()->create_course(); @@ -59,7 +59,7 @@ class mod_workshop_porfolio_caller_testcase extends advanced_testcase { /** * Tear down. */ - protected function tearDown() { + protected function tearDown(): void { $this->workshop = null; $this->cm = null; parent::tearDown(); diff --git a/mod/workshop/tests/privacy_provider_test.php b/mod/workshop/tests/privacy_provider_test.php index a59388deea8..7a093845aa8 100644 --- a/mod/workshop/tests/privacy_provider_test.php +++ b/mod/workshop/tests/privacy_provider_test.php @@ -120,7 +120,7 @@ class mod_workshop_privacy_provider_testcase extends advanced_testcase { * * etc. */ - protected function setUp() { + protected function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/my/tests/events_test.php b/my/tests/events_test.php index 3fe006a23f6..f5d0a37475b 100644 --- a/my/tests/events_test.php +++ b/my/tests/events_test.php @@ -40,7 +40,7 @@ class dashboard_events_testcase extends advanced_testcase { /** * Setup often used objects for the following tests. */ - protected function setup() { + protected function setUp(): void { global $USER; $this->resetAfterTest(); diff --git a/notes/tests/events_test.php b/notes/tests/events_test.php index 02d5dbe7034..655fb28e5f3 100644 --- a/notes/tests/events_test.php +++ b/notes/tests/events_test.php @@ -41,7 +41,7 @@ class core_notes_events_testcase extends advanced_testcase { /** @var stdClass A complete record from post table */ private $noterecord; - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/notes/tests/lib_test.php b/notes/tests/lib_test.php index 69b0001967b..db21796e16b 100644 --- a/notes/tests/lib_test.php +++ b/notes/tests/lib_test.php @@ -50,7 +50,7 @@ class core_notes_lib_testcase extends advanced_testcase { */ private $tree; - public function setUp() { + public function setUp(): void { $this->user = $this->getDataGenerator()->create_user(); $this->course = $this->getDataGenerator()->create_course(); $this->tree = new \core_user\output\myprofile\tree(); @@ -114,4 +114,4 @@ class core_notes_lib_testcase extends advanced_testcase { $nodes->setAccessible(true); $this->assertArrayNotHasKey('notes', $nodes->getValue($this->tree)); } -} \ No newline at end of file +} diff --git a/privacy/classes/tests/provider_testcase.php b/privacy/classes/tests/provider_testcase.php index 92b30b51621..c4405041a79 100644 --- a/privacy/classes/tests/provider_testcase.php +++ b/privacy/classes/tests/provider_testcase.php @@ -39,7 +39,7 @@ abstract class provider_testcase extends \advanced_testcase { /** * Test tearDown. */ - public function tearDown() { + public function tearDown(): void { \core_privacy\local\request\writer::reset(); } diff --git a/privacy/tests/manager_test.php b/privacy/tests/manager_test.php index eb1a0551df7..d395091baf0 100644 --- a/privacy/tests/manager_test.php +++ b/privacy/tests/manager_test.php @@ -45,7 +45,7 @@ class privacy_manager_testcase extends advanced_testcase { /** * Test tearDown. */ - public function tearDown() { + public function tearDown(): void { \core_privacy\local\request\writer::reset(); } diff --git a/privacy/tests/writer_test.php b/privacy/tests/writer_test.php index be8bb465cca..47960afd270 100644 --- a/privacy/tests/writer_test.php +++ b/privacy/tests/writer_test.php @@ -45,7 +45,7 @@ class writer_test extends advanced_testcase { * Ensure that the writer is cleared away as appropriate after each * test. */ - public function tearDown() { + public function tearDown(): void { writer::reset(); } diff --git a/question/behaviour/adaptive/tests/behaviourtype_test.php b/question/behaviour/adaptive/tests/behaviourtype_test.php index 58cd548ec39..82951113920 100644 --- a/question/behaviour/adaptive/tests/behaviourtype_test.php +++ b/question/behaviour/adaptive/tests/behaviourtype_test.php @@ -42,7 +42,7 @@ class qbehaviour_adaptive_type_test extends basic_testcase { /** @var qbehaviour_adaptive_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('adaptive'); } diff --git a/question/behaviour/adaptive/tests/mark_display_test.php b/question/behaviour/adaptive/tests/mark_display_test.php index 5a91a25bb95..f8d7fedcd46 100644 --- a/question/behaviour/adaptive/tests/mark_display_test.php +++ b/question/behaviour/adaptive/tests/mark_display_test.php @@ -44,7 +44,7 @@ class qbehaviour_adaptive_mark_display_test extends basic_testcase { /** @var question_display_options display options to use when rendering. */ protected $options; - protected function setUp() { + protected function setUp(): void { global $PAGE; parent::setUp(); $this->renderer = $PAGE->get_renderer('qbehaviour_adaptive'); diff --git a/question/behaviour/deferredcbm/tests/behaviourtype_test.php b/question/behaviour/deferredcbm/tests/behaviourtype_test.php index a4892e6247e..5fdff4959b3 100644 --- a/question/behaviour/deferredcbm/tests/behaviourtype_test.php +++ b/question/behaviour/deferredcbm/tests/behaviourtype_test.php @@ -43,7 +43,7 @@ class qbehaviour_deferredcbm_type_test extends qbehaviour_walkthrough_test_base /** @var qbehaviour_deferredcbm_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('deferredcbm'); } diff --git a/question/behaviour/deferredfeedback/tests/behaviourtype_test.php b/question/behaviour/deferredfeedback/tests/behaviourtype_test.php index 3bedc80fd53..9bb1eff7927 100644 --- a/question/behaviour/deferredfeedback/tests/behaviourtype_test.php +++ b/question/behaviour/deferredfeedback/tests/behaviourtype_test.php @@ -42,7 +42,7 @@ class qbehaviour_deferredfeedback_type_test extends qbehaviour_walkthrough_test_ /** @var qbehaviour_deferredfeedback_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('deferredfeedback'); } diff --git a/question/behaviour/immediatecbm/tests/behaviourtype_test.php b/question/behaviour/immediatecbm/tests/behaviourtype_test.php index 8c137599f9e..6c4ca9ee2bd 100644 --- a/question/behaviour/immediatecbm/tests/behaviourtype_test.php +++ b/question/behaviour/immediatecbm/tests/behaviourtype_test.php @@ -42,7 +42,7 @@ class qbehaviour_immediatecbm_type_test extends qbehaviour_walkthrough_test_base /** @var qbehaviour_immediatecbm_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('immediatecbm'); } diff --git a/question/behaviour/immediatefeedback/tests/behaviourtype_test.php b/question/behaviour/immediatefeedback/tests/behaviourtype_test.php index 2d9b5cafdeb..354dccd4b44 100644 --- a/question/behaviour/immediatefeedback/tests/behaviourtype_test.php +++ b/question/behaviour/immediatefeedback/tests/behaviourtype_test.php @@ -42,7 +42,7 @@ class qbehaviour_immediatefeedback_type_test extends basic_testcase { /** @var qbehaviour_immediatefeedback_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('immediatefeedback'); } diff --git a/question/behaviour/informationitem/tests/behaviourtype_test.php b/question/behaviour/informationitem/tests/behaviourtype_test.php index e8f56cca71e..35c9e7d1fa5 100644 --- a/question/behaviour/informationitem/tests/behaviourtype_test.php +++ b/question/behaviour/informationitem/tests/behaviourtype_test.php @@ -42,7 +42,7 @@ class qbehaviour_informationitem_type_testcase extends basic_testcase { /** @var qbehaviour_informationitem_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('informationitem'); } diff --git a/question/behaviour/interactive/tests/behaviourtype_test.php b/question/behaviour/interactive/tests/behaviourtype_test.php index 36af6bb734c..7f4eab7a957 100644 --- a/question/behaviour/interactive/tests/behaviourtype_test.php +++ b/question/behaviour/interactive/tests/behaviourtype_test.php @@ -42,7 +42,7 @@ class qbehaviour_interactive_type_test extends basic_testcase { /** @var qbehaviour_interactive_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('interactive'); } diff --git a/question/behaviour/interactivecountback/tests/behaviourtype_test.php b/question/behaviour/interactivecountback/tests/behaviourtype_test.php index 0ce525310a6..ed5f20e1f32 100644 --- a/question/behaviour/interactivecountback/tests/behaviourtype_test.php +++ b/question/behaviour/interactivecountback/tests/behaviourtype_test.php @@ -42,7 +42,7 @@ class qbehaviour_interactivecountback_type_test extends basic_testcase { /** @var qbehaviour_interactivecountback_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('interactivecountback'); } diff --git a/question/behaviour/manualgraded/tests/behaviourtype_test.php b/question/behaviour/manualgraded/tests/behaviourtype_test.php index b0a987b0f55..0ba9aff5946 100644 --- a/question/behaviour/manualgraded/tests/behaviourtype_test.php +++ b/question/behaviour/manualgraded/tests/behaviourtype_test.php @@ -42,7 +42,7 @@ class qbehaviour_manualgraded_type_test extends basic_testcase { /** @var qbehaviour_manualgraded_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('manualgraded'); } diff --git a/question/behaviour/missing/tests/behaviourtype_test.php b/question/behaviour/missing/tests/behaviourtype_test.php index 3fd52145207..34d092f5418 100644 --- a/question/behaviour/missing/tests/behaviourtype_test.php +++ b/question/behaviour/missing/tests/behaviourtype_test.php @@ -42,7 +42,7 @@ class qbehaviour_missing_type_test extends basic_testcase { /** @var qbehaviour_missing_type */ protected $behaviourtype; - public function setUp() { + public function setUp(): void { parent::setUp(); $this->behaviourtype = question_engine::get_behaviour_type('missing'); } diff --git a/question/engine/tests/helpers.php b/question/engine/tests/helpers.php index 13d48b93fff..df59c5eec3d 100644 --- a/question/engine/tests/helpers.php +++ b/question/engine/tests/helpers.php @@ -796,7 +796,7 @@ abstract class qbehaviour_walkthrough_test_base extends question_testcase { */ protected $currentoutput = ''; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->resetAfterTest(true); @@ -805,7 +805,7 @@ abstract class qbehaviour_walkthrough_test_base extends question_testcase { context_system::instance()); } - protected function tearDown() { + protected function tearDown(): void { $this->displayoptions = null; $this->quba = null; parent::tearDown(); diff --git a/question/engine/tests/questionattempt_test.php b/question/engine/tests/questionattempt_test.php index 7047a41a0a2..6ef1436fd35 100644 --- a/question/engine/tests/questionattempt_test.php +++ b/question/engine/tests/questionattempt_test.php @@ -50,14 +50,14 @@ class question_attempt_testcase extends advanced_testcase { /** @var question_attempt a question attempt that can be used in the tests. */ private $qa; - protected function setUp() { + protected function setUp(): void { $this->question = test_question_maker::make_question('description'); $this->question->defaultmark = 3; $this->usageid = 13; $this->qa = new question_attempt($this->question, $this->usageid); } - protected function tearDown() { + protected function tearDown(): void { $this->question = null; $this->useageid = null; $this->qa = null; diff --git a/question/engine/tests/questionattempt_with_steps_test.php b/question/engine/tests/questionattempt_with_steps_test.php index b5194c008ac..7849943591f 100644 --- a/question/engine/tests/questionattempt_with_steps_test.php +++ b/question/engine/tests/questionattempt_with_steps_test.php @@ -44,7 +44,7 @@ class question_attempt_with_steps_test extends advanced_testcase { private $question; private $qa; - protected function setUp() { + protected function setUp(): void { $this->question = test_question_maker::make_question('description'); $this->qa = new testable_question_attempt($this->question, 0, null, 2); for ($i = 0; $i < 3; $i++) { @@ -53,7 +53,7 @@ class question_attempt_with_steps_test extends advanced_testcase { } } - protected function tearDown() { + protected function tearDown(): void { $this->qa = null; } diff --git a/question/engine/tests/questionattemptiterator_test.php b/question/engine/tests/questionattemptiterator_test.php index 81f20cab8e0..5453567e3b1 100644 --- a/question/engine/tests/questionattemptiterator_test.php +++ b/question/engine/tests/questionattemptiterator_test.php @@ -42,7 +42,7 @@ class question_attempt_iterator_test extends advanced_testcase { private $qas = array(); private $iterator; - protected function setUp() { + protected function setUp(): void { $this->quba = question_engine::make_questions_usage_by_activity('unit_test', context_system::instance()); $this->quba->set_preferred_behaviour('deferredfeedback'); @@ -56,7 +56,7 @@ class question_attempt_iterator_test extends advanced_testcase { $this->iterator = $this->quba->get_attempt_iterator(); } - protected function tearDown() { + protected function tearDown(): void { $this->quba = null; $this->iterator = null; } @@ -122,4 +122,4 @@ class question_attempt_iterator_test extends advanced_testcase { public function test_cannot_unset() { unset($this->iterator[2]); } -} \ No newline at end of file +} diff --git a/question/engine/tests/questionattemptstepiterator_test.php b/question/engine/tests/questionattemptstepiterator_test.php index 9d90654b65a..543282c6db3 100644 --- a/question/engine/tests/questionattemptstepiterator_test.php +++ b/question/engine/tests/questionattemptstepiterator_test.php @@ -41,7 +41,7 @@ class question_attempt_step_iterator_test extends advanced_testcase { private $qa; private $iterator; - protected function setUp() { + protected function setUp(): void { $question = test_question_maker::make_question('description'); $this->qa = new testable_question_attempt($question, 0); for ($i = 0; $i < 3; $i++) { @@ -51,7 +51,7 @@ class question_attempt_step_iterator_test extends advanced_testcase { $this->iterator = $this->qa->get_step_iterator(); } - protected function tearDown() { + protected function tearDown(): void { $this->qa = null; $this->iterator = null; } @@ -141,4 +141,4 @@ class question_attempt_step_iterator_test extends advanced_testcase { public function test_cannot_unset() { unset($this->iterator[2]); } -} \ No newline at end of file +} diff --git a/question/engine/tests/questionusage_autosave_test.php b/question/engine/tests/questionusage_autosave_test.php index 6ca87f43ad8..a5d9f977293 100644 --- a/question/engine/tests/questionusage_autosave_test.php +++ b/question/engine/tests/questionusage_autosave_test.php @@ -747,7 +747,7 @@ class question_usage_autosave_test extends qbehaviour_walkthrough_test_base { $this->delete_quba(); } - protected function tearDown() { + protected function tearDown(): void { // This test relies on the destructor for the second DB connection being called before running the next test. // Without this change - there will be unit test failures on "some" DBs (MySQL). gc_collect_cycles(); diff --git a/question/engine/tests/unitofwork_test.php b/question/engine/tests/unitofwork_test.php index 3756dc594e5..af86f114e42 100644 --- a/question/engine/tests/unitofwork_test.php +++ b/question/engine/tests/unitofwork_test.php @@ -47,7 +47,7 @@ class question_engine_unit_of_work_test extends data_loading_method_test_base { /** @var testable_question_engine_unit_of_work the unit of work we are testing. */ protected $observer; - protected function setUp() { + protected function setUp(): void { // Create a usage in an initial state, with one shortanswer question added, // and attempted in interactive mode submitted responses 'toad' then 'frog'. // Then set it to use a new unit of work for any subsequent changes. @@ -64,7 +64,7 @@ class question_engine_unit_of_work_test extends data_loading_method_test_base { $this->setup_initial_test_state($this->get_test_data()); } - public function tearDown() { + public function tearDown(): void { question_bank::end_unit_test(); } diff --git a/question/engine/upgrade/tests/helper.php b/question/engine/upgrade/tests/helper.php index b7614dbec04..7967ae2b324 100644 --- a/question/engine/upgrade/tests/helper.php +++ b/question/engine/upgrade/tests/helper.php @@ -97,14 +97,14 @@ abstract class question_attempt_upgrader_test_base extends advanced_testcase { protected $updater; protected $loader; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $logger = new dummy_question_engine_assumption_logger(); $this->loader = new test_question_engine_upgrade_question_loader($logger); $this->updater = new test_question_engine_attempt_upgrader($this->loader, $logger); } - protected function tearDown() { + protected function tearDown(): void { $this->updater = null; parent::tearDown(); } diff --git a/question/tests/category_class_test.php b/question/tests/category_class_test.php index 4bfaf200950..adbe41cea3a 100644 --- a/question/tests/category_class_test.php +++ b/question/tests/category_class_test.php @@ -46,7 +46,7 @@ class core_question_category_class_testcase extends advanced_testcase { */ protected $topcat; - protected function setUp() { + protected function setUp(): void { parent::setUp(); self::setAdminUser(); $this->resetAfterTest(); diff --git a/question/tests/events_test.php b/question/tests/events_test.php index 0f93b8605f9..bc03892bad5 100644 --- a/question/tests/events_test.php +++ b/question/tests/events_test.php @@ -34,7 +34,7 @@ class core_question_events_testcase extends advanced_testcase { /** * Tests set up. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/question/tests/externallib_test.php b/question/tests/externallib_test.php index 523198ec2dc..2315ae2afd6 100644 --- a/question/tests/externallib_test.php +++ b/question/tests/externallib_test.php @@ -45,7 +45,7 @@ class core_question_external_testcase extends externallib_advanced_testcase { /** * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/question/type/calculated/tests/questiontype_test.php b/question/type/calculated/tests/questiontype_test.php index 1292760e43c..46fcb70c31a 100644 --- a/question/type/calculated/tests/questiontype_test.php +++ b/question/type/calculated/tests/questiontype_test.php @@ -45,11 +45,11 @@ class qtype_calculated_test extends advanced_testcase { protected $tolerance = 0.00000001; protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_calculated(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/calculatedsimple/tests/questiontype_test.php b/question/type/calculatedsimple/tests/questiontype_test.php index 3f4ca511eed..35483c6732a 100644 --- a/question/type/calculatedsimple/tests/questiontype_test.php +++ b/question/type/calculatedsimple/tests/questiontype_test.php @@ -48,11 +48,11 @@ class qtype_calculatedsimple_test extends advanced_testcase { protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_calculatedsimple(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/ddimageortext/tests/questiontype_test.php b/question/type/ddimageortext/tests/questiontype_test.php index 0c36e33b858..8b6fbf52b36 100644 --- a/question/type/ddimageortext/tests/questiontype_test.php +++ b/question/type/ddimageortext/tests/questiontype_test.php @@ -40,11 +40,11 @@ class qtype_ddimageortext_test extends basic_testcase { /** @var qtype_ddimageortext instance of the question type class to test. */ protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = question_bank::get_qtype('ddimageortext');; } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/ddmarker/tests/questiontype_test.php b/question/type/ddmarker/tests/questiontype_test.php index 8bd3692113e..664577c21ac 100644 --- a/question/type/ddmarker/tests/questiontype_test.php +++ b/question/type/ddmarker/tests/questiontype_test.php @@ -41,11 +41,11 @@ class qtype_ddmarker_test extends advanced_testcase { /** @var qtype_ddmarker instance of the question type class to test. */ protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = question_bank::get_qtype('ddmarker');; } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/ddwtos/tests/questiontype_test.php b/question/type/ddwtos/tests/questiontype_test.php index ca7f562f0bd..2f650ca0b25 100644 --- a/question/type/ddwtos/tests/questiontype_test.php +++ b/question/type/ddwtos/tests/questiontype_test.php @@ -40,11 +40,11 @@ class qtype_ddwtos_test extends question_testcase { /** @var qtype_ddwtos instance of the question type class to test. */ protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = question_bank::get_qtype('ddwtos');; } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/description/tests/questiontype_test.php b/question/type/description/tests/questiontype_test.php index 60da13ef1c8..b2444800cee 100644 --- a/question/type/description/tests/questiontype_test.php +++ b/question/type/description/tests/questiontype_test.php @@ -41,11 +41,11 @@ require_once($CFG->dirroot . '/question/type/description/edit_description_form.p class qtype_description_test extends advanced_testcase { protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_description(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/essay/tests/questiontype_test.php b/question/type/essay/tests/questiontype_test.php index 1a34c3ab0e9..3dc8767bed6 100644 --- a/question/type/essay/tests/questiontype_test.php +++ b/question/type/essay/tests/questiontype_test.php @@ -39,11 +39,11 @@ require_once($CFG->dirroot . '/question/type/essay/questiontype.php'); class qtype_essay_test extends advanced_testcase { protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_essay(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/gapselect/tests/questiontype_test.php b/question/type/gapselect/tests/questiontype_test.php index 88ccadf28af..6598983ead6 100644 --- a/question/type/gapselect/tests/questiontype_test.php +++ b/question/type/gapselect/tests/questiontype_test.php @@ -39,11 +39,11 @@ class qtype_gapselect_test extends question_testcase { /** @var qtype_gapselect instance of the question type class to test. */ protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = question_bank::get_qtype('gapselect'); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/match/tests/questiontype_test.php b/question/type/match/tests/questiontype_test.php index baaf44daa21..0da8cacb219 100644 --- a/question/type/match/tests/questiontype_test.php +++ b/question/type/match/tests/questiontype_test.php @@ -42,11 +42,11 @@ class qtype_match_test extends advanced_testcase { /** @var qtype_match instance of the question type class to test. */ protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_match(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/multianswer/tests/questiontype_test.php b/question/type/multianswer/tests/questiontype_test.php index 22616347453..eb8e6071d4b 100644 --- a/question/type/multianswer/tests/questiontype_test.php +++ b/question/type/multianswer/tests/questiontype_test.php @@ -43,11 +43,11 @@ class qtype_multianswer_test extends advanced_testcase { /** @var qtype_multianswer instance of the question type class to test. */ protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_multianswer(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/multichoice/tests/questiontype_test.php b/question/type/multichoice/tests/questiontype_test.php index 4c9f1980f6c..c18ead0627c 100644 --- a/question/type/multichoice/tests/questiontype_test.php +++ b/question/type/multichoice/tests/questiontype_test.php @@ -40,11 +40,11 @@ require_once($CFG->dirroot . '/question/type/multichoice/edit_multichoice_form.p class qtype_multichoice_test extends advanced_testcase { protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_multichoice(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/numerical/tests/questiontype_test.php b/question/type/numerical/tests/questiontype_test.php index 90a087e0f22..9a39cde39f4 100644 --- a/question/type/numerical/tests/questiontype_test.php +++ b/question/type/numerical/tests/questiontype_test.php @@ -47,11 +47,11 @@ class qtype_numerical_test extends advanced_testcase { protected $tolerance = 0.00000001; protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_numerical(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/random/tests/questiontype_test.php b/question/type/random/tests/questiontype_test.php index 289966fdc15..38a38d29f61 100644 --- a/question/type/random/tests/questiontype_test.php +++ b/question/type/random/tests/questiontype_test.php @@ -40,11 +40,11 @@ require_once($CFG->dirroot . '/question/type/random/questiontype.php'); class qtype_random_test extends advanced_testcase { protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_random(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/shortanswer/tests/questiontype_test.php b/question/type/shortanswer/tests/questiontype_test.php index 2bfa9a90a82..71ec1fe72fb 100644 --- a/question/type/shortanswer/tests/questiontype_test.php +++ b/question/type/shortanswer/tests/questiontype_test.php @@ -45,11 +45,11 @@ class qtype_shortanswer_test extends advanced_testcase { protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_shortanswer(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/question/type/tests/question_first_matching_answer_grading_strategy_test.php b/question/type/tests/question_first_matching_answer_grading_strategy_test.php index 569d5f24a9a..5f1967f6e7b 100644 --- a/question/type/tests/question_first_matching_answer_grading_strategy_test.php +++ b/question/type/tests/question_first_matching_answer_grading_strategy_test.php @@ -58,10 +58,10 @@ class test_response_answer_comparer implements question_response_answer_comparer * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class question_first_matching_answer_grading_strategy_testcase extends advanced_testcase { - protected function setUp() { + protected function setUp(): void { } - protected function tearDown() { + protected function tearDown(): void { } public function test_no_answers_gives_null() { diff --git a/question/type/truefalse/tests/questiontype_test.php b/question/type/truefalse/tests/questiontype_test.php index 5f1a639f872..1408a443cc6 100644 --- a/question/type/truefalse/tests/questiontype_test.php +++ b/question/type/truefalse/tests/questiontype_test.php @@ -41,11 +41,11 @@ require_once($CFG->dirroot . '/question/type/truefalse/edit_truefalse_form.php') class qtype_truefalse_test extends advanced_testcase { protected $qtype; - protected function setUp() { + protected function setUp(): void { $this->qtype = new qtype_truefalse(); } - protected function tearDown() { + protected function tearDown(): void { $this->qtype = null; } diff --git a/rating/tests/externallib_test.php b/rating/tests/externallib_test.php index 1468d59e93c..4ffed3b5780 100644 --- a/rating/tests/externallib_test.php +++ b/rating/tests/externallib_test.php @@ -43,7 +43,7 @@ class core_rating_externallib_testcase extends externallib_advanced_testcase { /* * Set up for every test */ - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); diff --git a/rating/tests/rating_test.php b/rating/tests/rating_test.php index c066978da57..896a8bfcc4c 100644 --- a/rating/tests/rating_test.php +++ b/rating/tests/rating_test.php @@ -39,7 +39,7 @@ class core_rating_testcase extends advanced_testcase { protected $neededcaps = array('view', 'viewall', 'viewany', 'rate'); protected $originaldefaultfrontpageroleid; - public function setUp() { + public function setUp(): void { global $CFG; parent::setUp(); diff --git a/report/completion/tests/events_test.php b/report/completion/tests/events_test.php index a2b2dac43da..b18bd5ca748 100644 --- a/report/completion/tests/events_test.php +++ b/report/completion/tests/events_test.php @@ -38,7 +38,7 @@ class report_completion_events_testcase extends advanced_testcase { /** * Setup testcase. */ - public function setUp() { + public function setUp(): void { $this->setAdminUser(); $this->resetAfterTest(); } diff --git a/report/log/tests/events_test.php b/report/log/tests/events_test.php index 0426838aa18..67b36ac202e 100644 --- a/report/log/tests/events_test.php +++ b/report/log/tests/events_test.php @@ -38,7 +38,7 @@ class report_log_events_testcase extends advanced_testcase { /** * Setup testcase. */ - public function setUp() { + public function setUp(): void { $this->setAdminUser(); $this->resetAfterTest(); } diff --git a/report/log/tests/lib_test.php b/report/log/tests/lib_test.php index d35bc04c792..4ba92c1f0c0 100644 --- a/report/log/tests/lib_test.php +++ b/report/log/tests/lib_test.php @@ -50,7 +50,7 @@ class report_log_lib_testcase extends advanced_testcase { */ private $tree; - public function setUp() { + public function setUp(): void { $this->user = $this->getDataGenerator()->create_user(); $this->course = $this->getDataGenerator()->create_course(); $this->tree = new \core_user\output\myprofile\tree(); diff --git a/report/loglive/tests/events_test.php b/report/loglive/tests/events_test.php index df95829007e..a5dd4676665 100644 --- a/report/loglive/tests/events_test.php +++ b/report/loglive/tests/events_test.php @@ -38,7 +38,7 @@ class report_loglive_events_testcase extends advanced_testcase { /** * Setup testcase. */ - public function setUp() { + public function setUp(): void { $this->setAdminUser(); $this->resetAfterTest(); } diff --git a/report/outline/tests/lib_test.php b/report/outline/tests/lib_test.php index fa9f20811f0..4d7bb49e1d1 100644 --- a/report/outline/tests/lib_test.php +++ b/report/outline/tests/lib_test.php @@ -60,7 +60,7 @@ class report_outline_lib_testcase extends advanced_testcase { */ private $roleid; - public function setUp() { + public function setUp(): void { $this->user = $this->getDataGenerator()->create_user(); $this->user2 = $this->getDataGenerator()->create_user(); $this->course = $this->getDataGenerator()->create_course(); diff --git a/report/questioninstances/tests/events_test.php b/report/questioninstances/tests/events_test.php index f002176c5b0..53288e10140 100644 --- a/report/questioninstances/tests/events_test.php +++ b/report/questioninstances/tests/events_test.php @@ -36,7 +36,7 @@ class report_questioninstances_events_testcase extends advanced_testcase { /** * Setup testcase. */ - public function setUp() { + public function setUp(): void { $this->setAdminUser(); $this->resetAfterTest(); } diff --git a/report/stats/tests/events_test.php b/report/stats/tests/events_test.php index 74bd64b54ef..564dded59ae 100644 --- a/report/stats/tests/events_test.php +++ b/report/stats/tests/events_test.php @@ -38,7 +38,7 @@ class report_stats_events_testcase extends advanced_testcase { /** * Setup testcase. */ - public function setUp() { + public function setUp(): void { $this->setAdminUser(); $this->resetAfterTest(); } diff --git a/report/stats/tests/lib_test.php b/report/stats/tests/lib_test.php index cd935ecdb76..a4df67695cb 100644 --- a/report/stats/tests/lib_test.php +++ b/report/stats/tests/lib_test.php @@ -48,7 +48,7 @@ class report_stats_lib_testcase extends advanced_testcase { */ private $tree; - public function setUp() { + public function setUp(): void { $this->user = $this->getDataGenerator()->create_user(); $this->course = $this->getDataGenerator()->create_course(); $this->tree = new \core_user\output\myprofile\tree(); diff --git a/report/usersessions/tests/lib_test.php b/report/usersessions/tests/lib_test.php index 6bade9193b7..03ea06bb5df 100644 --- a/report/usersessions/tests/lib_test.php +++ b/report/usersessions/tests/lib_test.php @@ -52,7 +52,7 @@ class report_usersessions_lib_testcase extends advanced_testcase { */ private $tree; - public function setUp() { + public function setUp(): void { $this->user = $this->getDataGenerator()->create_user(); $this->course = $this->getDataGenerator()->create_course(); $this->tree = new \core_user\output\myprofile\tree(); diff --git a/repository/flickr/tests/privacy_test.php b/repository/flickr/tests/privacy_test.php index c86476be86b..71d1bba2648 100644 --- a/repository/flickr/tests/privacy_test.php +++ b/repository/flickr/tests/privacy_test.php @@ -38,7 +38,7 @@ class repository_flickr_privacy_testcase extends provider_testcase { /** * Overriding setUp() function to always reset after tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/repository/nextcloud/tests/access_controlled_link_manager_test.php b/repository/nextcloud/tests/access_controlled_link_manager_test.php index 178adefd762..78a98cf049a 100644 --- a/repository/nextcloud/tests/access_controlled_link_manager_test.php +++ b/repository/nextcloud/tests/access_controlled_link_manager_test.php @@ -53,7 +53,7 @@ class repository_nextcloud_access_controlled_link_manager_testcase extends advan /** * SetUp to create an repository instance. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(true); // Admin is necessary to create issuer object. @@ -630,4 +630,4 @@ XML; } } -} \ No newline at end of file +} diff --git a/repository/nextcloud/tests/lib_test.php b/repository/nextcloud/tests/lib_test.php index c8f3ec36c74..cf6fe64f5a1 100644 --- a/repository/nextcloud/tests/lib_test.php +++ b/repository/nextcloud/tests/lib_test.php @@ -45,7 +45,7 @@ class repository_nextcloud_lib_testcase extends advanced_testcase { /** * SetUp to create an repository instance. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(true); // Admin is neccessary to create api and issuer objects. diff --git a/repository/nextcloud/tests/ocs_test.php b/repository/nextcloud/tests/ocs_test.php index a96691b8953..a22747ce1e8 100644 --- a/repository/nextcloud/tests/ocs_test.php +++ b/repository/nextcloud/tests/ocs_test.php @@ -40,7 +40,7 @@ class repository_nextcloud_ocs_testcase extends advanced_testcase { /** * SetUp to create issuer and endpoints for OCS testing. */ - protected function setUp() { + protected function setUp(): void { $this->resetAfterTest(true); // Admin is neccessary to create issuer object. diff --git a/repository/onedrive/tests/privacy_test.php b/repository/onedrive/tests/privacy_test.php index afd258938b9..fd39f1e68b2 100644 --- a/repository/onedrive/tests/privacy_test.php +++ b/repository/onedrive/tests/privacy_test.php @@ -38,7 +38,7 @@ class repository_onedrive_privacy_testcase extends \core_privacy\tests\provider_ /** * Overriding setUp() function to always reset after tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/repository/recent/tests/lib_test.php b/repository/recent/tests/lib_test.php index 080999b2eae..66160d4294d 100644 --- a/repository/recent/tests/lib_test.php +++ b/repository/recent/tests/lib_test.php @@ -49,7 +49,7 @@ class repository_recent_lib_testcase extends advanced_testcase { /** * SetUp to create an repository instance. */ - protected function setUp() { + protected function setUp(): void { global $USER; $this->setAdminUser(); $this->usercontext = context_user::instance($USER->id); diff --git a/repository/tests/privacy_test.php b/repository/tests/privacy_test.php index 736d55187f2..9340baecace 100644 --- a/repository/tests/privacy_test.php +++ b/repository/tests/privacy_test.php @@ -41,7 +41,7 @@ class core_repository_privacy_testcase extends \core_privacy\tests\provider_test /** * Overriding setUp() function to always reset after tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/rss/tests/privacy_test.php b/rss/tests/privacy_test.php index 070b2abffbd..c49c24e202f 100644 --- a/rss/tests/privacy_test.php +++ b/rss/tests/privacy_test.php @@ -40,7 +40,7 @@ class core_rss_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/search/engine/simpledb/tests/engine_test.php b/search/engine/simpledb/tests/engine_test.php index 5ec0a699fdd..7c51dab6714 100644 --- a/search/engine/simpledb/tests/engine_test.php +++ b/search/engine/simpledb/tests/engine_test.php @@ -59,7 +59,7 @@ class search_simpledb_engine_testcase extends advanced_testcase { * * @return void */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); if ($this->requires_manual_index_update()) { @@ -86,7 +86,7 @@ class search_simpledb_engine_testcase extends advanced_testcase { * * @return void */ - public function tearDown() { + public function tearDown(): void { // For unit tests before PHP 7, teardown is called even on skip. So only do our teardown if we did setup. if ($this->generator) { // Moodle DML freaks out if we don't teardown the temp table after each run. diff --git a/search/engine/simpledb/tests/privacy_test.php b/search/engine/simpledb/tests/privacy_test.php index f88830c6501..23b1d31059a 100644 --- a/search/engine/simpledb/tests/privacy_test.php +++ b/search/engine/simpledb/tests/privacy_test.php @@ -41,7 +41,7 @@ require_once($CFG->dirroot . '/search/tests/fixtures/mock_search_area.php'); */ class privacy_model_testcase extends \core_privacy\tests\provider_testcase { - public function setUp() { + public function setUp(): void { global $DB; if ($this->requires_manual_index_update()) { @@ -103,7 +103,7 @@ class privacy_model_testcase extends \core_privacy\tests\provider_testcase { * * @return void */ - public function tearDown() { + public function tearDown(): void { // Call parent tearDown() first. parent::tearDown(); diff --git a/search/engine/solr/tests/engine_test.php b/search/engine/solr/tests/engine_test.php index 0acc303b3be..8c9f4917d79 100644 --- a/search/engine/solr/tests/engine_test.php +++ b/search/engine/solr/tests/engine_test.php @@ -68,7 +68,7 @@ class search_solr_engine_testcase extends advanced_testcase { */ protected $engine = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); set_config('enableglobalsearch', true); set_config('searchengine', 'solr'); @@ -136,7 +136,7 @@ class search_solr_engine_testcase extends advanced_testcase { $schema->setup(false); } - public function tearDown() { + public function tearDown(): void { // For unit tests before PHP 7, teardown is called even on skip. So only do our teardown if we did setup. if ($this->generator) { // Moodle DML freaks out if we don't teardown the temp table after each run. diff --git a/search/tests/base_activity_test.php b/search/tests/base_activity_test.php index 8f99a292d28..c58719911be 100644 --- a/search/tests/base_activity_test.php +++ b/search/tests/base_activity_test.php @@ -57,7 +57,7 @@ class search_base_activity_testcase extends advanced_testcase { /** @var stdClass[] Array of test forum objects */ protected $forums; - public function setUp() { + public function setUp(): void { global $DB; $this->resetAfterTest(); set_config('enableglobalsearch', true); @@ -102,7 +102,7 @@ class search_base_activity_testcase extends advanced_testcase { } } - public function tearDown() { + public function tearDown(): void { // For unit tests before PHP 7, teardown is called even on skip. So only do our teardown if we did setup. if ($this->generator) { // Moodle DML freaks out if we don't teardown the temp table after each run. diff --git a/search/tests/base_test.php b/search/tests/base_test.php index f55ac434964..f0a2ff17786 100644 --- a/search/tests/base_test.php +++ b/search/tests/base_test.php @@ -51,7 +51,7 @@ class search_base_testcase extends advanced_testcase { */ protected $engine = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); set_config('enableglobalsearch', true); @@ -62,7 +62,7 @@ class search_base_testcase extends advanced_testcase { $this->generator->setup(); } - public function tearDown() { + public function tearDown(): void { // For unit tests before PHP 7, teardown is called even on skip. So only do our teardown if we did setup. if ($this->generator) { // Moodle DML freaks out if we don't teardown the temp table after each run. diff --git a/search/tests/document_test.php b/search/tests/document_test.php index d74a2aab592..c60acba18e4 100644 --- a/search/tests/document_test.php +++ b/search/tests/document_test.php @@ -43,7 +43,7 @@ class search_document_testcase extends advanced_testcase { */ protected $generator = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); set_config('enableglobalsearch', true); @@ -119,7 +119,7 @@ class search_document_testcase extends advanced_testcase { $this->assertEquals($docicon, $document->get_doc_icon()); } - public function tearDown() { + public function tearDown(): void { // For unit tests before PHP 7, teardown is called even on skip. So only do our teardown if we did setup. if ($this->generator) { // Moodle DML freaks out if we don't teardown the temp table after each run. diff --git a/search/tests/engine_test.php b/search/tests/engine_test.php index 4fdba57f5a5..4ccd556a14a 100644 --- a/search/tests/engine_test.php +++ b/search/tests/engine_test.php @@ -38,7 +38,7 @@ require_once(__DIR__ . '/fixtures/mock_search_area.php'); */ class search_engine_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); set_config('enableglobalsearch', true); diff --git a/search/tests/external_test.php b/search/tests/external_test.php index fd4fc411b38..8f0a51401d9 100644 --- a/search/tests/external_test.php +++ b/search/tests/external_test.php @@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die(); */ class external_testcase extends \advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/search/tests/generator/lib.php b/search/tests/generator/lib.php index 562232e1f99..e042e28c775 100644 --- a/search/tests/generator/lib.php +++ b/search/tests/generator/lib.php @@ -37,7 +37,7 @@ class core_search_generator extends component_generator_base { /** * Creates the mock search area temp table. */ - public function setup() { + public function setUp(): void { global $DB; $dbman = $DB->get_manager(); @@ -56,7 +56,7 @@ class core_search_generator extends component_generator_base { /** * Destroys the mock search area temp table. */ - public function teardown() { + public function tearDown(): void { global $DB; $dbman = $DB->get_manager(); diff --git a/search/tests/manager_test.php b/search/tests/manager_test.php index 4cc4162b74c..27ed476adbb 100644 --- a/search/tests/manager_test.php +++ b/search/tests/manager_test.php @@ -53,12 +53,12 @@ class search_manager_testcase extends advanced_testcase { */ protected $coursesareaid = null; - public function setUp() { + public function setUp(): void { $this->forumpostareaid = \core_search\manager::generate_areaid('mod_forum', 'post'); $this->coursesareaid = \core_search\manager::generate_areaid('core_course', 'course'); } - protected function tearDown() { + protected function tearDown(): void { // Stop it from faking time in the search manager (if set by test). testable_core_search::fake_current_time(); parent::tearDown(); diff --git a/tag/tests/events_test.php b/tag/tests/events_test.php index 6c15e829d38..00e4d01d986 100644 --- a/tag/tests/events_test.php +++ b/tag/tests/events_test.php @@ -38,7 +38,7 @@ class core_tag_events_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/tag/tests/taglib_test.php b/tag/tests/taglib_test.php index 2fe96fafd73..28c62f9b7cb 100644 --- a/tag/tests/taglib_test.php +++ b/tag/tests/taglib_test.php @@ -34,7 +34,7 @@ class core_tag_taglib_testcase extends advanced_testcase { * * This is executed before running any test in this file. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/user/profile/field/checkbox/tests/privacy_test.php b/user/profile/field/checkbox/tests/privacy_test.php index a1a3d1f5b09..9f4862e84bb 100644 --- a/user/profile/field/checkbox/tests/privacy_test.php +++ b/user/profile/field/checkbox/tests/privacy_test.php @@ -39,7 +39,7 @@ class profilefield_checkbox_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/user/profile/field/datetime/tests/privacy_test.php b/user/profile/field/datetime/tests/privacy_test.php index ce789d29ecc..d18026e044a 100644 --- a/user/profile/field/datetime/tests/privacy_test.php +++ b/user/profile/field/datetime/tests/privacy_test.php @@ -39,7 +39,7 @@ class profilefield_datetime_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/user/profile/field/menu/tests/privacy_test.php b/user/profile/field/menu/tests/privacy_test.php index 208eab214d0..ff399ebb7d6 100644 --- a/user/profile/field/menu/tests/privacy_test.php +++ b/user/profile/field/menu/tests/privacy_test.php @@ -39,7 +39,7 @@ class profilefield_menu_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/user/profile/field/text/tests/privacy_test.php b/user/profile/field/text/tests/privacy_test.php index 57e3f3461f8..a5c35d5ff1c 100644 --- a/user/profile/field/text/tests/privacy_test.php +++ b/user/profile/field/text/tests/privacy_test.php @@ -39,7 +39,7 @@ class profilefield_text_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/user/profile/field/textarea/tests/privacy_test.php b/user/profile/field/textarea/tests/privacy_test.php index 52347f43964..5ed8bb49b61 100644 --- a/user/profile/field/textarea/tests/privacy_test.php +++ b/user/profile/field/textarea/tests/privacy_test.php @@ -39,7 +39,7 @@ class profilefield_textarea_testcase extends provider_testcase { /** * Basic setup for these tests. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); } diff --git a/user/tests/search_test.php b/user/tests/search_test.php index 710681d5fd8..0cf7d23b0d9 100644 --- a/user/tests/search_test.php +++ b/user/tests/search_test.php @@ -41,7 +41,7 @@ class user_search_testcase extends advanced_testcase { */ protected $userareaid = null; - public function setUp() { + public function setUp(): void { $this->resetAfterTest(true); set_config('enableglobalsearch', true); diff --git a/webservice/tests/events_test.php b/webservice/tests/events_test.php index 955d49b1fcf..467340a7271 100644 --- a/webservice/tests/events_test.php +++ b/webservice/tests/events_test.php @@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die(); */ class core_webservice_events_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/webservice/tests/externallib_test.php b/webservice/tests/externallib_test.php index fe56e750563..1fe5fcc0eb8 100644 --- a/webservice/tests/externallib_test.php +++ b/webservice/tests/externallib_test.php @@ -30,7 +30,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php'); */ class core_webservice_externallib_testcase extends externallib_advanced_testcase { - public function setUp() { + public function setUp(): void { // Calling parent is good, always parent::setUp(); diff --git a/webservice/tests/lib_test.php b/webservice/tests/lib_test.php index 59d741c7415..407556b0dda 100644 --- a/webservice/tests/lib_test.php +++ b/webservice/tests/lib_test.php @@ -40,7 +40,7 @@ class webservice_test extends advanced_testcase { /** * Setup. */ - public function setUp() { + public function setUp(): void { // Calling parent is good, always. parent::setUp(); diff --git a/webservice/tests/privacy_test.php b/webservice/tests/privacy_test.php index d7b4da0ec00..d18f18fef40 100644 --- a/webservice/tests/privacy_test.php +++ b/webservice/tests/privacy_test.php @@ -47,7 +47,7 @@ require_once($CFG->dirroot . '/webservice/lib.php'); */ class core_webservice_privacy_testcase extends provider_testcase { - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); } diff --git a/webservice/xmlrpc/tests/lib_test.php b/webservice/xmlrpc/tests/lib_test.php index c97c36f1076..32862a77d63 100644 --- a/webservice/xmlrpc/tests/lib_test.php +++ b/webservice/xmlrpc/tests/lib_test.php @@ -41,7 +41,7 @@ class webservice_xmlrpc_test extends advanced_testcase { /** * Setup. */ - public function setUp() { + public function setUp(): void { $this->resetAfterTest(); // All tests require xmlrpc. Skip tests, if xmlrpc is not installed. diff --git a/webservice/xmlrpc/tests/locallib_test.php b/webservice/xmlrpc/tests/locallib_test.php index ad99cbed8eb..54371da1ae8 100644 --- a/webservice/xmlrpc/tests/locallib_test.php +++ b/webservice/xmlrpc/tests/locallib_test.php @@ -41,7 +41,7 @@ class webservice_xmlrpc_locallib_testcase extends advanced_testcase { /** * Setup. */ - public function setUp() { + public function setUp(): void { if (!function_exists('xmlrpc_decode')) { $this->markTestSkipped('XMLRPC is not installed.'); } diff --git a/webservice/xmlrpc/tests/xmlrpc_server_test.php b/webservice/xmlrpc/tests/xmlrpc_server_test.php index a4f6feaa740..1641266b0b1 100644 --- a/webservice/xmlrpc/tests/xmlrpc_server_test.php +++ b/webservice/xmlrpc/tests/xmlrpc_server_test.php @@ -41,7 +41,7 @@ class xmlrpc_server_test extends advanced_testcase { /** * Setup. */ - public function setUp() { + public function setUp(): void { if (!function_exists('xmlrpc_decode')) { $this->markTestSkipped('XMLRPC is not installed.'); }