diff --git a/admin/tool/dataprivacy/tests/expired_contexts_test.php b/admin/tool/dataprivacy/tests/expired_contexts_test.php index 4b8680c4d7a7..d851000ba6a0 100644 --- a/admin/tool/dataprivacy/tests/expired_contexts_test.php +++ b/admin/tool/dataprivacy/tests/expired_contexts_test.php @@ -867,7 +867,7 @@ public function test_process_user_context_with_override_unexpired_role(): void { /** * Ensure that a module context previously flagged as approved is removed with appropriate unexpiredroles kept. */ - public function test_process_course_context_with_override_unexpired_role() { + public function test_process_course_context_with_override_unexpired_role(): void { global $DB; $this->resetAfterTest(); @@ -955,7 +955,7 @@ public function test_process_course_context_with_override_unexpired_role() { /** * Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept. */ - public function test_process_course_context_with_override_expired_role() { + public function test_process_course_context_with_override_expired_role(): void { global $DB; $this->resetAfterTest(); @@ -1043,7 +1043,7 @@ public function test_process_course_context_with_override_expired_role() { /** * Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept. */ - public function test_process_course_context_with_user_in_both_lists() { + public function test_process_course_context_with_user_in_both_lists(): void { global $DB; $this->resetAfterTest(); @@ -1132,7 +1132,7 @@ public function test_process_course_context_with_user_in_both_lists() { /** * Ensure that a module context previously flagged as approved is removed with appropriate expiredroles kept. */ - public function test_process_course_context_with_user_in_both_lists_expired() { + public function test_process_course_context_with_user_in_both_lists_expired(): void { global $DB; $this->resetAfterTest(); diff --git a/admin/tool/dataprivacy/tests/manager_observer_test.php b/admin/tool/dataprivacy/tests/manager_observer_test.php index 7296eb181d1e..4902dcd2c849 100644 --- a/admin/tool/dataprivacy/tests/manager_observer_test.php +++ b/admin/tool/dataprivacy/tests/manager_observer_test.php @@ -32,7 +32,7 @@ class manager_observer_test extends data_privacy_testcase { /** * Ensure that when users are configured as DPO, they are sent an message upon failure. */ - public function test_handle_component_failure() { + public function test_handle_component_failure(): void { $this->resetAfterTest(); // Create another user who is not a DPO. diff --git a/admin/tool/generator/tests/maketestcourse_test.php b/admin/tool/generator/tests/maketestcourse_test.php index a257a42262c1..11670ec10f19 100644 --- a/admin/tool/generator/tests/maketestcourse_test.php +++ b/admin/tool/generator/tests/maketestcourse_test.php @@ -30,7 +30,7 @@ class maketestcourse_test extends \advanced_testcase { /** * Creates a small test course and checks all the components have been put in place. */ - public function test_make_xs_course() { + public function test_make_xs_course(): void { global $DB; $this->resetAfterTest(); diff --git a/admin/tool/policy/tests/api_test.php b/admin/tool/policy/tests/api_test.php index 7a7605a23e6c..ee4973f2b3b5 100644 --- a/admin/tool/policy/tests/api_test.php +++ b/admin/tool/policy/tests/api_test.php @@ -193,7 +193,7 @@ public function test_policy_sortorder(): void { /** * Test that list of policies can be filtered by audience */ - public function test_list_policies_audience() { + public function test_list_policies_audience(): void { $this->resetAfterTest(); $this->setAdminUser(); diff --git a/cache/tests/administration_helper_test.php b/cache/tests/administration_helper_test.php index b61cc087a8a0..49b3dd1a06fd 100644 --- a/cache/tests/administration_helper_test.php +++ b/cache/tests/administration_helper_test.php @@ -60,7 +60,7 @@ public static function tearDownAfterClass(): void { /** * Test the numerous summaries the helper can produce. */ - public function test_get_summaries() { + public function test_get_summaries(): void { // First the preparation. $config = cache_config_writer::instance(); $this->assertTrue($config->add_store_instance('summariesstore', 'file')); diff --git a/calendar/tests/event_factory_test.php b/calendar/tests/event_factory_test.php index 3fabf8e85592..b571aa7ea90f 100644 --- a/calendar/tests/event_factory_test.php +++ b/calendar/tests/event_factory_test.php @@ -85,7 +85,7 @@ public function test_create_instance( /** * Test invalid callback exception. */ - public function test_invalid_action_callback() { + public function test_invalid_action_callback(): void { $this->resetAfterTest(true); $this->setAdminUser(); $event = $this->create_event(); @@ -135,7 +135,7 @@ function () { /** * Test invalid callback exception. */ - public function test_invalid_visibility_callback() { + public function test_invalid_visibility_callback(): void { $this->resetAfterTest(true); $this->setAdminUser(); $event = $this->create_event(); @@ -185,7 +185,7 @@ function () { /** * Test invalid callback exception. */ - public function test_invalid_bail_callback() { + public function test_invalid_bail_callback(): void { $this->resetAfterTest(true); $this->setAdminUser(); $event = $this->create_event(); @@ -235,7 +235,7 @@ function () { /** * Test the factory's course cache. */ - public function test_course_cache() { + public function test_course_cache(): void { $this->resetAfterTest(true); $this->setAdminUser(); $course = self::getDataGenerator()->create_course(); @@ -288,7 +288,7 @@ function () { /** * Test the factory's module cache. */ - public function test_module_cache() { + public function test_module_cache(): void { $this->resetAfterTest(true); $this->setAdminUser(); $course = self::getDataGenerator()->create_course(); diff --git a/calendar/tests/event_vault_test.php b/calendar/tests/event_vault_test.php index d03ab45ea80b..c8c29368325b 100644 --- a/calendar/tests/event_vault_test.php +++ b/calendar/tests/event_vault_test.php @@ -196,7 +196,7 @@ public function test_get_action_events_by_timesort_between_time_after_event(): v * provided timesort values and the last seen event can be provided to * get paginated results. */ - public function test_get_action_events_by_timesort_between_time_skip_even_records() { + public function test_get_action_events_by_timesort_between_time_skip_even_records(): void { $this->resetAfterTest(true); $this->setAdminuser(); @@ -247,7 +247,7 @@ public function test_get_action_events_by_timesort_between_time_skip_even_record * number of events requested has been satisfied. In this case the first * five events are rejected so it should require two database requests. */ - public function test_get_action_events_by_timesort_between_time_skip_first_records() { + public function test_get_action_events_by_timesort_between_time_skip_first_records(): void { $this->resetAfterTest(true); $this->setAdminuser(); @@ -423,7 +423,7 @@ public function test_get_action_events_by_timesort_non_consecutive_ids(): void { * - A user in group B should see only the B override * - A user in both A and B should see both */ - public function test_get_action_events_by_timesort_with_identical_group_override_priorities() { + public function test_get_action_events_by_timesort_with_identical_group_override_priorities(): void { $this->resetAfterTest(); $this->setAdminuser(); @@ -804,7 +804,7 @@ public function test_get_action_events_by_course_between_time_after_event(): voi * provided timesort values and the last seen event can be provided to * get paginated results. */ - public function test_get_action_events_by_course_between_time_skip_even_records() { + public function test_get_action_events_by_course_between_time_skip_even_records(): void { $user = $this->getDataGenerator()->create_user(); $course1 = $this->getDataGenerator()->create_course(); $course2 = $this->getDataGenerator()->create_course(); @@ -870,7 +870,7 @@ public function test_get_action_events_by_course_between_time_skip_even_records( * number of events requested has been satisfied. In this case the first * five events are rejected so it should require two database requests. */ - public function test_get_action_events_by_course_between_time_skip_first_records() { + public function test_get_action_events_by_course_between_time_skip_first_records(): void { $user = $this->getDataGenerator()->create_user(); $course1 = $this->getDataGenerator()->create_course(); $course2 = $this->getDataGenerator()->create_course(); @@ -1080,7 +1080,7 @@ public function test_get_action_events_by_course_non_consecutive_ids(): void { * - A user in group B should see only the B override * - A user in both A and B should see both */ - public function test_get_action_events_by_course_with_identical_group_override_priorities() { + public function test_get_action_events_by_course_with_identical_group_override_priorities(): void { $this->resetAfterTest(); $this->setAdminuser(); diff --git a/calendar/tests/externallib_test.php b/calendar/tests/externallib_test.php index 33ee8a22d90b..e987aaa7eac0 100644 --- a/calendar/tests/externallib_test.php +++ b/calendar/tests/externallib_test.php @@ -1425,7 +1425,7 @@ public function test_get_calendar_action_events_by_course_with_search(): void { * Test that get_action_events_by_courses will return a list of events for each * course you provided as long as the user is enrolled in the course. */ - public function test_get_action_events_by_courses() { + public function test_get_action_events_by_courses(): void { $user = $this->getDataGenerator()->create_user(); $course1 = $this->getDataGenerator()->create_course(); $course2 = $this->getDataGenerator()->create_course(); @@ -1558,7 +1558,7 @@ public function test_get_action_events_by_courses() { /** * Test get_action_events_by_courses with search feature */ - public function test_get_action_events_by_courses_with_search() { + public function test_get_action_events_by_courses_with_search(): void { // Generate data. $user = $this->getDataGenerator()->create_user(); $course1 = $this->getDataGenerator()->create_course(); diff --git a/calendar/tests/std_proxy_test.php b/calendar/tests/std_proxy_test.php index 9658a6098faa..af3080df9790 100644 --- a/calendar/tests/std_proxy_test.php +++ b/calendar/tests/std_proxy_test.php @@ -54,7 +54,7 @@ public function setUp(): void { * @param string $member Object member to retrieve. * @param mixed $expected Expected value of member. */ - public function test_proxy($id, $member, $expected) { + public function test_proxy($id, $member, $expected): void { $proxy = new std_proxy($id, function($id) { return $this->objects[$id]; }); @@ -70,7 +70,7 @@ public function test_proxy($id, $member, $expected) { * @param string $member Object member to retrieve. * @param mixed $storedvalue Value as would be stored externally. */ - public function test_base_values($id, $member, $storedvalue) { + public function test_base_values($id, $member, $storedvalue): void { $proxy = new std_proxy( $id, function($id) { @@ -89,7 +89,7 @@ function($id) { * @dataProvider get_set_testcases * @param int $id ID of the object being proxied. */ - public function test_get_invalid_member($id) { + public function test_get_invalid_member($id): void { $proxy = new std_proxy($id, function($id) { return $this->objects[$id]; }); @@ -104,7 +104,7 @@ public function test_get_invalid_member($id) { * @dataProvider get_set_testcases * @param int $id Object ID. */ - public function test_get_proxied_instance($id) { + public function test_get_proxied_instance($id): void { $proxy = new std_proxy($id, function($id) { return $this->objects[$id]; }); diff --git a/competency/tests/privacy/provider_test.php b/competency/tests/privacy/provider_test.php index 2e8f39aa8ea8..dff9fe5cf1da 100644 --- a/competency/tests/privacy/provider_test.php +++ b/competency/tests/privacy/provider_test.php @@ -1999,7 +1999,7 @@ public function test_export_data_for_user_with_related_learning_plans(): void { $this->assert_exported_comments(['Hi.'], $data->comments); } - public function test_export_data_for_user_with_related_competencies() { + public function test_export_data_for_user_with_related_competencies(): void { $path = [ get_string('competencies', 'core_competency'), get_string('privacy:path:relatedtome', 'core_competency'), diff --git a/course/tests/backup/restore_test.php b/course/tests/backup/restore_test.php index 26ebb90dc317..bfd98f5752bc 100644 --- a/course/tests/backup/restore_test.php +++ b/course/tests/backup/restore_test.php @@ -387,7 +387,7 @@ public function test_restore_course_info_in_new_course(): void { $this->assertEquals($startdate, $c2->startdate); } - public function test_restore_course_with_users() { + public function test_restore_course_with_users(): void { global $DB; $this->resetAfterTest(); $this->setAdminUser(); diff --git a/course/tests/caching_content_item_readonly_repository_test.php b/course/tests/caching_content_item_readonly_repository_test.php index ffb76c639018..9ea96b426f41 100644 --- a/course/tests/caching_content_item_readonly_repository_test.php +++ b/course/tests/caching_content_item_readonly_repository_test.php @@ -39,7 +39,7 @@ class caching_content_item_readonly_repository_test extends \advanced_testcase { /** * Test verifying that content items are cached and returned from the cache in subsequent same-request calls. */ - public function test_find_all_for_course() { + public function test_find_all_for_course(): void { $this->resetAfterTest(); global $DB; diff --git a/course/tests/category_test.php b/course/tests/category_test.php index c1ec14a69975..f17709fce11f 100644 --- a/course/tests/category_test.php +++ b/course/tests/category_test.php @@ -751,7 +751,7 @@ public function test_course_contacts(): void { $CFG->coursecontact = $oldcoursecontact; } - public function test_course_contacts_with_duplicates() { + public function test_course_contacts_with_duplicates(): void { global $DB, $CFG; set_config('coursecontactduplicates', true); diff --git a/course/tests/content_item_readonly_repository_test.php b/course/tests/content_item_readonly_repository_test.php index 84406076c093..8a6b30aff565 100644 --- a/course/tests/content_item_readonly_repository_test.php +++ b/course/tests/content_item_readonly_repository_test.php @@ -76,7 +76,7 @@ public function test_find_all_for_course_hidden_module(): void { /** * Test confirming that all content items can be fetched, even those which require certain caps when in a course. */ - public function test_find_all() { + public function test_find_all(): void { $this->resetAfterTest(); global $DB, $CFG; diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php index 7fdaf62202fb..45338180d388 100644 --- a/course/tests/courselib_test.php +++ b/course/tests/courselib_test.php @@ -4582,7 +4582,7 @@ public function get_course_classify_courses_for_timeline_test_cases() { * @param array $coursesdata Courses to create * @param array $expected Expected test results. */ - public function test_course_classify_courses_for_timeline($coursesdata, $expected) { + public function test_course_classify_courses_for_timeline($coursesdata, $expected): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); @@ -4723,7 +4723,7 @@ public function test_course_get_enrolled_courses_for_logged_in_user( $offset, $expecteddbqueries, $expectedresult - ) { + ): void { global $DB; $this->resetAfterTest(); @@ -4908,7 +4908,7 @@ public function get_course_filter_courses_by_timeline_classification_test_cases( /** * Test the course_get_enrolled_courses_for_logged_in_user_from_search function. */ - public function test_course_get_enrolled_courses_for_logged_in_user_from_search() { + public function test_course_get_enrolled_courses_for_logged_in_user_from_search(): void { global $DB; // Set up. @@ -5021,7 +5021,7 @@ public function test_course_filter_courses_by_timeline_classification( $offset, $expectedcourses, $expectedprocessedcount - ) { + ): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); @@ -5242,7 +5242,7 @@ public function test_course_filter_courses_by_customfield( $offset, $expectedcourses, $expectedprocessedcount - ) { + ): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); @@ -5487,7 +5487,7 @@ public function test_course_filter_courses_by_timeline_classification_with_hidde $expectedcourses, $expectedprocessedcount, $hiddencourse - ) { + ): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); $student = $generator->create_user(); @@ -6983,7 +6983,7 @@ public function test_course_get_course_dates_for_user_ids( $enrolmentmethods, $enrolled, $expected - ) { + ): void { global $DB; $this->resetAfterTest(); diff --git a/course/tests/externallib_test.php b/course/tests/externallib_test.php index a560bf98674b..606af80929c3 100644 --- a/course/tests/externallib_test.php +++ b/course/tests/externallib_test.php @@ -3747,7 +3747,7 @@ public function test_get_enrolled_courses_by_timeline_classification( $expectednextoffset, $expectedexception = null, $searchvalue = null - ) { + ): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); @@ -3979,7 +3979,7 @@ public function test_get_enrolled_users_by_cmid(): void { /** * Verify that content items can be added to user favourites. */ - public function test_add_content_item_to_user_favourites() { + public function test_add_content_item_to_user_favourites(): void { $this->resetAfterTest(); $course = $this->getDataGenerator()->create_course(); @@ -4017,7 +4017,7 @@ public function test_add_content_item_to_user_favourites() { /** * Verify that content items can be removed from user favourites. */ - public function test_remove_content_item_from_user_favourites() { + public function test_remove_content_item_from_user_favourites(): void { $this->resetAfterTest(); $course = $this->getDataGenerator()->create_course(); @@ -4057,7 +4057,7 @@ public function test_remove_content_item_from_user_favourites() { /** * Test the web service returning course content items for inclusion in activity choosers, etc. */ - public function test_get_course_content_items() { + public function test_get_course_content_items(): void { $this->resetAfterTest(); $course = self::getDataGenerator()->create_course(); diff --git a/enrol/lti/tests/local/ltiadvantage/repository/published_resource_repository_test.php b/enrol/lti/tests/local/ltiadvantage/repository/published_resource_repository_test.php index 58bc5635d685..9a9baac241b4 100644 --- a/enrol/lti/tests/local/ltiadvantage/repository/published_resource_repository_test.php +++ b/enrol/lti/tests/local/ltiadvantage/repository/published_resource_repository_test.php @@ -98,7 +98,7 @@ protected function generate_published_resources() { * * @covers ::find_all_for_user */ - public function test_find_all_for_user() { + public function test_find_all_for_user(): void { $this->resetAfterTest(); [$user, $user2, $user3, $course, $course2, $mod, $mod2, $mod3, $mod4] = $this->generate_published_resources(); @@ -131,7 +131,7 @@ public function test_find_all_for_user() { * * @covers ::find_all_by_ids_for_user */ - public function test_find_all_by_ids_for_user() { + public function test_find_all_by_ids_for_user(): void { $this->resetAfterTest(); [$user, $user2, $user3, $course, $course2, $mod, $mod2, $mod3, $mod4, $coursetool, $tool, $tool2, $tool3, $tool4] = $this->generate_published_resources(); diff --git a/enrol/lti/tests/local/ltiadvantage/repository/resource_link_repository_test.php b/enrol/lti/tests/local/ltiadvantage/repository/resource_link_repository_test.php index 4526cb3ab3ff..7d69fdb41210 100644 --- a/enrol/lti/tests/local/ltiadvantage/repository/resource_link_repository_test.php +++ b/enrol/lti/tests/local/ltiadvantage/repository/resource_link_repository_test.php @@ -167,7 +167,7 @@ public function test_find(): void { * * @covers ::find_by_resource */ - public function test_find_by_resource() { + public function test_find_by_resource(): void { $this->resetAfterTest(); $resourcelink = $this->generate_resource_link(); $repository = new resource_link_repository(); @@ -196,7 +196,7 @@ public function test_find_by_resource() { * * @covers ::find_by_resource_and_user */ - public function test_find_by_resource_and_user() { + public function test_find_by_resource_and_user(): void { global $CFG; $this->resetAfterTest(); $resourcelink = $this->generate_resource_link(); diff --git a/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php b/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php index 3db54e83d4a4..eccca4c60091 100644 --- a/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php +++ b/enrol/lti/tests/local/ltiadvantage/task/sync_members_test.php @@ -726,7 +726,7 @@ public function test_sync_non_lti_linked_user(): void { * @covers ::execute */ public function test_sync_enrolments_and_migration(?array $legacydata, ?array $resourceconfig, array $launchdata, - ?array $syncmembers, array $expected) { + ?array $syncmembers, array $expected): void { $this->resetAfterTest(); diff --git a/enrol/lti/tests/local/ltiadvantage/task/sync_tool_grades_test.php b/enrol/lti/tests/local/ltiadvantage/task/sync_tool_grades_test.php index f661e03ab080..72b95b813ba0 100644 --- a/enrol/lti/tests/local/ltiadvantage/task/sync_tool_grades_test.php +++ b/enrol/lti/tests/local/ltiadvantage/task/sync_tool_grades_test.php @@ -743,7 +743,7 @@ public function test_sync_grades_failed_service_call(): void { * * @covers ::execute */ - public function test_sync_grades_coupled_lineitem() { + public function test_sync_grades_coupled_lineitem(): void { $this->resetAfterTest(); [$course, $resource] = $this->create_test_environment(); @@ -817,7 +817,7 @@ public function test_sync_grades_coupled_lineitem() { * * @covers ::execute */ - public function test_sync_grades_none_or_many_lineitems_activity_context() { + public function test_sync_grades_none_or_many_lineitems_activity_context(): void { $this->resetAfterTest(); [$course, $resource] = $this->create_test_environment(); @@ -894,7 +894,7 @@ public function test_sync_grades_none_or_many_lineitems_activity_context() { * * @covers ::execute */ - public function test_sync_grades_none_or_many_lineitems_course_context() { + public function test_sync_grades_none_or_many_lineitems_course_context(): void { $this->resetAfterTest(); [$course, $tool1, $tool2, $resource] = $this->create_test_environment(); diff --git a/enrol/tests/enrollib_test.php b/enrol/tests/enrollib_test.php index 2280c144741b..b19530f67262 100644 --- a/enrol/tests/enrollib_test.php +++ b/enrol/tests/enrollib_test.php @@ -1308,7 +1308,7 @@ public function test_enrol_get_my_courses_sort_by_last_access( $limit, $offset, $expectedcourses - ) { + ): void { global $DB, $CFG; $this->resetAfterTest(); diff --git a/lib/dml/tests/dml_test.php b/lib/dml/tests/dml_test.php index b00b1f897dba..f93189cc40cd 100644 --- a/lib/dml/tests/dml_test.php +++ b/lib/dml/tests/dml_test.php @@ -533,7 +533,7 @@ public function test_add_sql_debugging(): void { * * @covers ::add_sql_debugging */ - public function test_sql_debugging_anon_class() { + public function test_sql_debugging_anon_class(): void { global $CFG; $CFG->debugsqltrace = 100; diff --git a/lib/filebrowser/tests/file_browser_test.php b/lib/filebrowser/tests/file_browser_test.php index 6d0123bbd077..5044a810b46f 100644 --- a/lib/filebrowser/tests/file_browser_test.php +++ b/lib/filebrowser/tests/file_browser_test.php @@ -109,7 +109,7 @@ public function setUp(): void { /** * Test "Server files" from the system context */ - public function test_file_info_context_system() { + public function test_file_info_context_system(): void { // There is one non-empty category child and two category children. @@ -126,7 +126,7 @@ public function test_file_info_context_system() { /** * Test "Server files" from the system context, hide Misc category */ - public function test_file_info_context_system_hidden() { + public function test_file_info_context_system_hidden(): void { // Hide the course category that contains our two courses. Teacher does not have cap to view hidden categories. \core_course_category::get($this->course1->category)->update(['visible' => 0]); @@ -153,7 +153,7 @@ public function test_file_info_context_system_hidden() { /** * Test "Server files" from the course category context */ - public function test_file_info_context_coursecat() { + public function test_file_info_context_coursecat(): void { // There are two non-empty courses. @@ -183,7 +183,7 @@ public function test_file_info_context_coursecat_jpg(): void { /** * Test "Server files" from the course context (course1) */ - public function test_file_info_context_course_1() { + public function test_file_info_context_course_1(): void { $browser = get_file_browser(); $fileinfo = $browser->get_file_info(\context_course::instance($this->course1->id)); @@ -214,7 +214,7 @@ public function test_file_info_context_course_1() { /** * Test "Server files" from the course context (course1) */ - public function test_file_info_context_course_2() { + public function test_file_info_context_course_2(): void { // 2. Start from the course level. $browser = get_file_browser(); diff --git a/lib/filestorage/tests/file_storage_test.php b/lib/filestorage/tests/file_storage_test.php index d5acb1c931b1..2c1500942b9e 100644 --- a/lib/filestorage/tests/file_storage_test.php +++ b/lib/filestorage/tests/file_storage_test.php @@ -540,7 +540,7 @@ private function setup_three_private_files() { * * @covers ::get_area_files */ - public function test_get_area_files() { + public function test_get_area_files(): void { $user = $this->setup_three_private_files(); $fs = get_file_storage(); diff --git a/lib/form/tests/filetypes_util_test.php b/lib/form/tests/filetypes_util_test.php index d932964423f3..f1cd3d5f7c7f 100644 --- a/lib/form/tests/filetypes_util_test.php +++ b/lib/form/tests/filetypes_util_test.php @@ -273,7 +273,7 @@ public function test_get_not_listed(): void { /** * Test populating the tree for the browser. */ - public function test_data_for_browser() { + public function test_data_for_browser(): void { $this->resetAfterTest(true); $util = new filetypes_util(); diff --git a/lib/phpunit/tests/phpunit_dataset_test.php b/lib/phpunit/tests/phpunit_dataset_test.php index c0c1cd64d6f6..56dc9a29cc0f 100644 --- a/lib/phpunit/tests/phpunit_dataset_test.php +++ b/lib/phpunit/tests/phpunit_dataset_test.php @@ -771,7 +771,7 @@ public function to_database_provider() { * @dataProvider to_database_provider * @covers ::to_database */ - public function test_to_database(array $files, ?array $filter, ?string $exception, array $columns, array $rows) { + public function test_to_database(array $files, ?array $filter, ?string $exception, array $columns, array $rows): void { global $DB; $this->resetAfterTest(); diff --git a/lib/tests/authlib_test.php b/lib/tests/authlib_test.php index 1e02010f7eda..cb649428f1da 100644 --- a/lib/tests/authlib_test.php +++ b/lib/tests/authlib_test.php @@ -448,7 +448,7 @@ public function test_user_loggedin_event_exceptions(): void { /** * Test the {@link signup_validate_data()} duplicate email validation. */ - public function test_signup_validate_data_same_email() { + public function test_signup_validate_data_same_email(): void { global $CFG; require_once($CFG->libdir . '/authlib.php'); require_once($CFG->libdir . '/phpmailer/moodle_phpmailer.php'); diff --git a/lib/tests/core_media_player_native_test.php b/lib/tests/core_media_player_native_test.php index 6d563f47c20a..5841c4bbbfec 100644 --- a/lib/tests/core_media_player_native_test.php +++ b/lib/tests/core_media_player_native_test.php @@ -58,7 +58,7 @@ public function test_get_supported_extensions(): void { /** * Test method list_supported_urls */ - public function test_list_supported_urls() { + public function test_list_supported_urls(): void { global $CFG; require_once($CFG->libdir . '/filelib.php'); $nativeextensions = file_get_typegroup('extension', ['html_video', 'html_audio']); diff --git a/lib/tests/curl_security_helper_test.php b/lib/tests/curl_security_helper_test.php index 3d92e9f588b7..568ff290d9fa 100644 --- a/lib/tests/curl_security_helper_test.php +++ b/lib/tests/curl_security_helper_test.php @@ -37,7 +37,7 @@ class curl_security_helper_test extends \advanced_testcase { * @param bool $expected the expected result. * @dataProvider curl_security_url_data_provider */ - public function test_curl_security_helper_url_is_blocked($dns, $url, $blockedhosts, $allowedports, $expected) { + public function test_curl_security_helper_url_is_blocked($dns, $url, $blockedhosts, $allowedports, $expected): void { $this->resetAfterTest(true); $helper = $this->getMockBuilder('\core\files\curl_security_helper') ->onlyMethods(['get_host_list_by_name']) diff --git a/lib/tests/grouplib_test.php b/lib/tests/grouplib_test.php index ac363b42cc2f..b76bf7f9e38c 100644 --- a/lib/tests/grouplib_test.php +++ b/lib/tests/grouplib_test.php @@ -2050,7 +2050,7 @@ public function test_get_all_groups_with_visibility(): void { * * @covers \groups_get_my_groups() */ - public function test_get_my_groups_with_visibility() { + public function test_get_my_groups_with_visibility(): void { list($users, $groups) = $this->create_groups_with_visibilty(); // Assign users to groups. diff --git a/lib/tests/navigation/output/primary_test.php b/lib/tests/navigation/output/primary_test.php index 54e042c2ae16..25507be00665 100644 --- a/lib/tests/navigation/output/primary_test.php +++ b/lib/tests/navigation/output/primary_test.php @@ -54,7 +54,7 @@ public function setUp(): void { * otherwise consider the user as non-logged in * @param array $expecteditems An array of nodes expected with content in them. */ - public function test_primary_export(bool $withcustom, bool $withlang, string $userloggedin, array $expecteditems) { + public function test_primary_export(bool $withcustom, bool $withlang, string $userloggedin, array $expecteditems): void { global $PAGE, $CFG; if ($withcustom) { $CFG->custommenuitems = "Course search|/course/search.php diff --git a/lib/tests/output/mustache_helper_collection_test.php b/lib/tests/output/mustache_helper_collection_test.php index 049225e907c2..296bd0185ae1 100644 --- a/lib/tests/output/mustache_helper_collection_test.php +++ b/lib/tests/output/mustache_helper_collection_test.php @@ -140,7 +140,7 @@ public function test_strip_disallowed_helpers($disallowed, $input, $expected): v * Any allowed helper should still be available to call during the * execution of a helper. */ - public function test_disallowed_helpers_disabled_during_execution() { + public function test_disallowed_helpers_disabled_during_execution(): void { $engine = new \Mustache_Engine(); $context = new \Mustache_Context(); $lambdahelper = new \Mustache_LambdaHelper($engine, $context); diff --git a/lib/tests/questionlib_test.php b/lib/tests/questionlib_test.php index d4a7e07273f4..fa362c262211 100644 --- a/lib/tests/questionlib_test.php +++ b/lib/tests/questionlib_test.php @@ -695,7 +695,7 @@ public function test_get_question_options_course_tags_in_course_question_context * get_question_options includes the tags and course tags for all questions in the list * if each question has course and question level tags. */ - public function test_get_question_options_includes_question_and_course_tags() { + public function test_get_question_options_includes_question_and_course_tags(): void { list($category, $course, $quiz, $qcat, $questions) = $this->setup_quiz_and_questions('category'); $question1 = $questions[0]; $question2 = $questions[1]; diff --git a/lib/tests/task/database_logger_test.php b/lib/tests/task/database_logger_test.php index 1a0261332d43..80588bf2fd29 100644 --- a/lib/tests/task/database_logger_test.php +++ b/lib/tests/task/database_logger_test.php @@ -212,7 +212,7 @@ public function test_store_log_for_task_adhoc_userid(): void { * @dataProvider delete_task_logs_provider * @param mixed $ids */ - public function test_delete_task_logs($ids) { + public function test_delete_task_logs($ids): void { $DB = $this->mock_database(); $DB->expects($this->once()) ->method('delete_records_list') diff --git a/login/tests/login_lib_test.php b/login/tests/login_lib_test.php index bdafdf7a1d96..2cab15a41740 100644 --- a/login/tests/login_lib_test.php +++ b/login/tests/login_lib_test.php @@ -383,7 +383,7 @@ public function test_core_login_validate_forgot_password_data($data, $errors = [ * * Email addresses should be handled as case-insensitive but accent sensitive. */ - public function test_core_login_process_password_reset_email_sensitivity() { + public function test_core_login_process_password_reset_email_sensitivity(): void { global $CFG; require_once($CFG->libdir.'/phpmailer/moodle_phpmailer.php'); diff --git a/media/player/html5audio/tests/player_test.php b/media/player/html5audio/tests/player_test.php index da8bd0056152..2650ab06905d 100644 --- a/media/player/html5audio/tests/player_test.php +++ b/media/player/html5audio/tests/player_test.php @@ -70,7 +70,7 @@ public function test_get_supported_extensions(): void { /** * Test method list_supported_urls() */ - public function test_list_supported_urls() { + public function test_list_supported_urls(): void { global $CFG; require_once($CFG->libdir . '/filelib.php'); diff --git a/media/player/html5video/tests/player_test.php b/media/player/html5video/tests/player_test.php index 66aaf731e5d0..98ee415ca842 100644 --- a/media/player/html5video/tests/player_test.php +++ b/media/player/html5video/tests/player_test.php @@ -67,7 +67,7 @@ public function test_get_supported_extensions(): void { /** * Test method list_supported_urls() */ - public function test_list_supported_urls() { + public function test_list_supported_urls(): void { global $CFG; require_once($CFG->libdir . '/filelib.php'); diff --git a/message/tests/api_test.php b/message/tests/api_test.php index cceae4fa6639..b5801e8e492f 100644 --- a/message/tests/api_test.php +++ b/message/tests/api_test.php @@ -1277,7 +1277,7 @@ public function test_get_conversations_message_format(): void { /** * Test verifying get_conversations identifies if a conversation is muted or not. */ - public function test_get_conversations_some_muted() { + public function test_get_conversations_some_muted(): void { // Create some users. $user1 = self::getDataGenerator()->create_user(); $user2 = self::getDataGenerator()->create_user(); @@ -5749,7 +5749,7 @@ public function test_get_conversation_counts( $expectedcounts, $expectedunreadcounts, $deletedusers - ) { + ): void { $generator = $this->getDataGenerator(); $users = [ $generator->create_user(), @@ -5872,7 +5872,7 @@ public function test_get_unread_conversation_counts( $expectedcounts, $expectedunreadcounts, $deletedusers - ) { + ): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); $users = [ diff --git a/message/tests/externallib_test.php b/message/tests/externallib_test.php index a4b6f7f72fe3..6769c630c8ac 100644 --- a/message/tests/externallib_test.php +++ b/message/tests/externallib_test.php @@ -2032,7 +2032,7 @@ public function test_get_user_notification_preferences_permissions(): void { * If checks this by placing some users in the same course, where default caps would permit a user to view another user's * profile. */ - public function test_message_search_users_messagingallusers_disabled() { + public function test_message_search_users_messagingallusers_disabled(): void { global $DB; $this->resetAfterTest(); @@ -2128,7 +2128,7 @@ public function test_message_search_users_messagingallusers_disabled() { * This test verifies that any contacts are returned, as well as any non-contacts, regardless of whether the searching user * can view their respective profile. */ - public function test_message_search_users_messagingallusers_enabled() { + public function test_message_search_users_messagingallusers_enabled(): void { global $DB; $this->resetAfterTest(); @@ -4395,7 +4395,7 @@ public function test_get_conversations_user_in_group_and_individual_chat(): void /** * Test verifying get_conversations identifies if a conversation is muted or not. */ - public function test_get_conversations_some_muted() { + public function test_get_conversations_some_muted(): void { $this->resetAfterTest(); // Create some users. @@ -5518,7 +5518,7 @@ public function test_get_conversation_counts( $expectedcounts, $expectedunreadcounts, $deletedusers - ) { + ): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); $users = [ @@ -5615,7 +5615,7 @@ public function test_get_unread_conversation_counts( $expectedcounts, $expectedunreadcounts, $deletedusers - ) { + ): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); $users = [ diff --git a/message/tests/privacy/provider_test.php b/message/tests/privacy/provider_test.php index f3f6c8f82fbc..8f8cb4a6a7da 100644 --- a/message/tests/privacy/provider_test.php +++ b/message/tests/privacy/provider_test.php @@ -1048,7 +1048,7 @@ public function test_delete_data_for_all_users_in_context(): void { /** * Test for provider::delete_data_for_user(). */ - public function test_delete_data_for_user() { + public function test_delete_data_for_user(): void { global $DB; $this->resetAfterTest(); @@ -1382,7 +1382,7 @@ public function test_get_users_in_context_with_blocked_contact(): void { /** * Test for provider::delete_data_for_users(). */ - public function test_delete_data_for_users() { + public function test_delete_data_for_users(): void { global $DB; $this->resetAfterTest(); @@ -1866,7 +1866,7 @@ public function test_export_conversations(): void { /** * Test for provider::delete_conversations_for_all_users(). */ - public function test_delete_conversations_for_all_users() { + public function test_delete_conversations_for_all_users(): void { global $DB; $this->resetAfterTest(); @@ -2391,7 +2391,7 @@ public function test_delete_conversations_for_all_users_usercontext(): void { /** * Test for provider::delete_conversations_for_user(). */ - public function test_delete_conversations_for_user() { + public function test_delete_conversations_for_user(): void { global $DB; $this->resetAfterTest(); @@ -2589,7 +2589,7 @@ public function test_delete_conversations_for_user() { /** * Test for provider::delete_conversations_for_users(). */ - public function test_delete_conversations_for_users() { + public function test_delete_conversations_for_users(): void { global $DB; $this->resetAfterTest(); diff --git a/mod/assign/tests/external/start_submission_test.php b/mod/assign/tests/external/start_submission_test.php index 2394ceaf9fc6..682d7d221631 100644 --- a/mod/assign/tests/external/start_submission_test.php +++ b/mod/assign/tests/external/start_submission_test.php @@ -69,7 +69,7 @@ public function test_start_submission_when_user_has_no_capability_to_view_assign /** * Test start_submission if assignment cut off date has elapsed. */ - public function test_start_submission_when_assignment_past_due_date() { + public function test_start_submission_when_assignment_past_due_date(): void { $fiveminago = time() - 300; list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status( false, ['cutoffdate' => $fiveminago]); @@ -87,7 +87,7 @@ public function test_start_submission_when_assignment_past_due_date() { /** * Test start_submission if time limit is disabled. */ - public function test_start_submission_when_time_limit_disabled() { + public function test_start_submission_when_time_limit_disabled(): void { list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status(); $result = start_submission::execute($instance->id); $filteredwarnings = array_filter($result['warnings'], function($warning) { @@ -103,7 +103,7 @@ public function test_start_submission_when_time_limit_disabled() { /** * Test start_submission if time limit is not set for assignment. */ - public function test_start_submission_when_time_limit_not_set() { + public function test_start_submission_when_time_limit_not_set(): void { set_config('enabletimelimit', '1', 'assign'); list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status(); $result = start_submission::execute($instance->id); @@ -120,7 +120,7 @@ public function test_start_submission_when_time_limit_not_set() { /** * Test start_submission if user already has open submission. */ - public function test_start_submission_when_submission_already_open() { + public function test_start_submission_when_submission_already_open(): void { global $DB; set_config('enabletimelimit', '1', 'assign'); list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status( @@ -142,7 +142,7 @@ public function test_start_submission_when_submission_already_open() { /** * Test start_submission if user has already submitted with no additional attempts available. */ - public function test_start_submission_with_no_attempts_available() { + public function test_start_submission_with_no_attempts_available(): void { global $DB; set_config('enabletimelimit', '1', 'assign'); list($assign, $instance, $student1, $student2, $teacher, $g1, $g2) = $this->create_submission_for_testing_status( diff --git a/mod/assign/tests/externallib_test.php b/mod/assign/tests/externallib_test.php index 7919f6bab418..1e519aba23e2 100644 --- a/mod/assign/tests/externallib_test.php +++ b/mod/assign/tests/externallib_test.php @@ -332,7 +332,7 @@ public function test_get_assignments(): void { /** * Test get_assignments with submissionstatement. */ - public function test_get_assignments_with_submissionstatement() { + public function test_get_assignments_with_submissionstatement(): void { global $DB, $USER, $CFG; $this->resetAfterTest(true); diff --git a/mod/assign/tests/lib_test.php b/mod/assign/tests/lib_test.php index 42ffbeca3ece..a07412c540d4 100644 --- a/mod/assign/tests/lib_test.php +++ b/mod/assign/tests/lib_test.php @@ -1377,7 +1377,7 @@ public function test_student_role_cant_update_due_event(): void { * able to update the assignment due date by changing the due date calendar * event. */ - public function test_teacher_role_can_update_due_event() { + public function test_teacher_role_can_update_due_event(): void { global $CFG, $DB; require_once($CFG->dirroot . '/calendar/lib.php'); diff --git a/mod/bigbluebuttonbn/tests/external/get_recordings_test.php b/mod/bigbluebuttonbn/tests/external/get_recordings_test.php index 556c894d3be0..ddda640e7cdf 100644 --- a/mod/bigbluebuttonbn/tests/external/get_recordings_test.php +++ b/mod/bigbluebuttonbn/tests/external/get_recordings_test.php @@ -379,7 +379,7 @@ public function test_get_imported_recordings_only(): void { * @covers \mod_bigbluebuttonbn\external\get_recordings::execute * @dataProvider recording_group_test_data */ - public function test_get_recordings_groups($type, $groups, $users, $recordingsdata, $test, $coursemode) { + public function test_get_recordings_groups($type, $groups, $users, $recordingsdata, $test, $coursemode): void { $this->resetAfterTest(); $dataset = compact('type', 'groups', 'users', 'recordingsdata', 'test', 'coursemode'); $activityid = $this->create_from_dataset($dataset); diff --git a/mod/bigbluebuttonbn/tests/lib_test.php b/mod/bigbluebuttonbn/tests/lib_test.php index 166ee95bd191..1fb00a50bd5c 100644 --- a/mod/bigbluebuttonbn/tests/lib_test.php +++ b/mod/bigbluebuttonbn/tests/lib_test.php @@ -130,7 +130,7 @@ public function test_bigbluebuttonbn_delete_instance_with_running_meeting(): voi * * @covers ::bigbluebuttonbn_delete_instance */ - public function test_bigbluebuttonbn_delete_instance_with_running_group_meetings() { + public function test_bigbluebuttonbn_delete_instance_with_running_group_meetings(): void { $this->resetAfterTest(); $this->initialise_mock_server(); $datagenerator = $this->getDataGenerator(); @@ -224,7 +224,7 @@ public function test_bigbluebuttonbn_user_complete(): void { * * @covers ::bigbluebuttonbn_get_recent_mod_activity */ - public function test_bigbluebuttonbn_get_recent_mod_activity() { + public function test_bigbluebuttonbn_get_recent_mod_activity(): void { $this->initialise_mock_server(); $this->resetAfterTest(); diff --git a/mod/bigbluebuttonbn/tests/local/proxy/recording_proxy_test.php b/mod/bigbluebuttonbn/tests/local/proxy/recording_proxy_test.php index e50dd4a1c0ec..829597a91465 100644 --- a/mod/bigbluebuttonbn/tests/local/proxy/recording_proxy_test.php +++ b/mod/bigbluebuttonbn/tests/local/proxy/recording_proxy_test.php @@ -37,7 +37,7 @@ class recording_proxy_test extends \advanced_testcase { * * @return void */ - public function test_fetch_recordings() { + public function test_fetch_recordings(): void { $this->resetAfterTest(); $this->initialise_mock_server(); [$context, $cm, $bbbactivity] = $this->create_instance(); @@ -55,7 +55,7 @@ public function test_fetch_recordings() { * * @return void */ - public function test_fetch_recordings_breakoutroom() { + public function test_fetch_recordings_breakoutroom(): void { $this->resetAfterTest(); $this->initialise_mock_server(); [$context, $cm, $bbbactivity] = $this->create_instance(); diff --git a/mod/bigbluebuttonbn/tests/output/recording_row_playback_test.php b/mod/bigbluebuttonbn/tests/output/recording_row_playback_test.php index 510a789c6047..2c859d778ec7 100644 --- a/mod/bigbluebuttonbn/tests/output/recording_row_playback_test.php +++ b/mod/bigbluebuttonbn/tests/output/recording_row_playback_test.php @@ -95,7 +95,7 @@ public function setUp(): void { * @covers \recording_row_playback::should_be_included * @dataProvider should_be_included_data_provider */ - public function test_should_be_included(string $role, array $canview, object $globalsettings = null) { + public function test_should_be_included(string $role, array $canview, object $globalsettings = null): void { global $PAGE; $this->resetAfterTest(); ['recordings' => $recordingsdata, 'activity' => $activity] = $this->create_activity_with_recordings( diff --git a/mod/choice/tests/lib_test.php b/mod/choice/tests/lib_test.php index a5a7108db7ac..9cd5eecf49f4 100644 --- a/mod/choice/tests/lib_test.php +++ b/mod/choice/tests/lib_test.php @@ -889,7 +889,7 @@ public function test_mod_choice_core_calendar_event_timestart_updated_unknown_ev * A CHOICE_EVENT_TYPE_OPEN event should update the timeopen property of * the choice activity. */ - public function test_mod_choice_core_calendar_event_timestart_updated_open_event() { + public function test_mod_choice_core_calendar_event_timestart_updated_open_event(): void { global $CFG, $DB; require_once($CFG->dirroot . "/calendar/lib.php"); @@ -950,7 +950,7 @@ public function test_mod_choice_core_calendar_event_timestart_updated_open_event * A CHOICE_EVENT_TYPE_CLOSE event should update the timeclose property of * the choice activity. */ - public function test_mod_choice_core_calendar_event_timestart_updated_close_event() { + public function test_mod_choice_core_calendar_event_timestart_updated_close_event(): void { global $CFG, $DB; require_once($CFG->dirroot . "/calendar/lib.php"); diff --git a/mod/data/tests/lib_test.php b/mod/data/tests/lib_test.php index 1e4c7a45ff10..15b194289972 100644 --- a/mod/data/tests/lib_test.php +++ b/mod/data/tests/lib_test.php @@ -1706,7 +1706,7 @@ public function test_mod_data_core_calendar_event_timestart_updated_unknown_even /** * A DATA_EVENT_TYPE_OPEN event should update the timeavailablefrom property of the data activity. */ - public function test_mod_data_core_calendar_event_timestart_updated_open_event() { + public function test_mod_data_core_calendar_event_timestart_updated_open_event(): void { global $CFG, $DB; require_once($CFG->dirroot . "/calendar/lib.php"); @@ -1763,7 +1763,7 @@ public function test_mod_data_core_calendar_event_timestart_updated_open_event() /** * A DATA_EVENT_TYPE_CLOSE event should update the timeavailableto property of the data activity. */ - public function test_mod_data_core_calendar_event_timestart_updated_close_event() { + public function test_mod_data_core_calendar_event_timestart_updated_close_event(): void { global $CFG, $DB; require_once($CFG->dirroot . "/calendar/lib.php"); diff --git a/mod/data/tests/manager_test.php b/mod/data/tests/manager_test.php index 65d829a1109a..3fae83e2d86e 100644 --- a/mod/data/tests/manager_test.php +++ b/mod/data/tests/manager_test.php @@ -222,7 +222,7 @@ public function test_has_fields(): void { * * @covers ::get_available_presets */ - public function test_get_available_presets() { + public function test_get_available_presets(): void { global $DB; $this->resetAfterTest(); @@ -323,7 +323,7 @@ public function test_get_available_presets() { * * @covers ::get_available_plugin_presets */ - public function test_get_available_plugin_presets() { + public function test_get_available_plugin_presets(): void { $this->resetAfterTest(); $this->setAdminUser(); @@ -369,7 +369,7 @@ public function test_get_available_plugin_presets() { * * @covers ::get_available_saved_presets */ - public function test_get_available_saved_presets() { + public function test_get_available_saved_presets(): void { global $DB; $this->resetAfterTest(); diff --git a/mod/data/tests/preset_test.php b/mod/data/tests/preset_test.php index 4df4c3b38feb..163bfd09545a 100644 --- a/mod/data/tests/preset_test.php +++ b/mod/data/tests/preset_test.php @@ -208,7 +208,7 @@ public function test_create_from_fullname(): void { * * @covers ::save */ - public function test_save_new_preset() { + public function test_save_new_preset(): void { $this->resetAfterTest(); $this->setAdminUser(); diff --git a/mod/feedback/tests/lib_test.php b/mod/feedback/tests/lib_test.php index ebddb43138c9..0656b3fc2f1b 100644 --- a/mod/feedback/tests/lib_test.php +++ b/mod/feedback/tests/lib_test.php @@ -1076,7 +1076,7 @@ public function test_student_role_cant_update_time_close_event(): void { * The activity should update if a teacher modifies the calendar * event. */ - public function test_teacher_role_can_update_time_close_event() { + public function test_teacher_role_can_update_time_close_event(): void { global $CFG, $DB; require_once($CFG->dirroot . '/calendar/lib.php'); diff --git a/mod/forum/tests/builders_exported_posts_test.php b/mod/forum/tests/builders_exported_posts_test.php index c8822db5fd57..fd88c64363a4 100644 --- a/mod/forum/tests/builders_exported_posts_test.php +++ b/mod/forum/tests/builders_exported_posts_test.php @@ -142,7 +142,7 @@ public function test_build_throws_exception_on_missing_discussions(): void { * Test the build function returns the exported posts in the order that the posts are * given. */ - public function test_build_returns_posts_in_order() { + public function test_build_returns_posts_in_order(): void { $this->resetAfterTest(); $datagenerator = $this->getDataGenerator(); @@ -185,7 +185,7 @@ public function test_build_returns_posts_in_order() { /** * Test the build function loads authors. */ - public function test_build_loads_authors() { + public function test_build_loads_authors(): void { $this->resetAfterTest(); $datagenerator = $this->getDataGenerator(); @@ -230,7 +230,7 @@ public function test_build_loads_authors() { /** * Test the build function loads attachments. */ - public function test_build_loads_attachments() { + public function test_build_loads_attachments(): void { $this->resetAfterTest(); $datagenerator = $this->getDataGenerator(); @@ -306,7 +306,7 @@ public function test_build_loads_attachments() { /** * Test the build function loads author groups. */ - public function test_build_loads_author_groups() { + public function test_build_loads_author_groups(): void { $this->resetAfterTest(); $datagenerator = $this->getDataGenerator(); @@ -376,7 +376,7 @@ public function test_build_loads_author_groups() { /** * Test the build function loads tags. */ - public function test_build_loads_tags() { + public function test_build_loads_tags(): void { $this->resetAfterTest(); $datagenerator = $this->getDataGenerator(); @@ -437,7 +437,7 @@ public function test_build_loads_tags() { /** * Test the build function loads read_receipts. */ - public function test_build_loads_read_receipts() { + public function test_build_loads_read_receipts(): void { $this->resetAfterTest(); $datagenerator = $this->getDataGenerator(); diff --git a/mod/forum/tests/entities_sorter_test.php b/mod/forum/tests/entities_sorter_test.php index 28e32e285a60..62b4697fcf28 100644 --- a/mod/forum/tests/entities_sorter_test.php +++ b/mod/forum/tests/entities_sorter_test.php @@ -29,7 +29,7 @@ class entities_sorter_test extends \advanced_testcase { /** * Test the entity returns expected values. */ - public function test_entity_sort_into_children() { + public function test_entity_sort_into_children(): void { $this->resetAfterTest(); $sorter = new sorter_entity( function($entity) { @@ -59,7 +59,7 @@ function($entity) { /** * Test the entity returns expected values. */ - public function test_entity_flatten_children() { + public function test_entity_flatten_children(): void { $this->resetAfterTest(); $sorter = new sorter_entity( function($entity) { diff --git a/mod/forum/tests/privacy/provider_test.php b/mod/forum/tests/privacy/provider_test.php index 0e47f7fefd66..11f18124b65c 100644 --- a/mod/forum/tests/privacy/provider_test.php +++ b/mod/forum/tests/privacy/provider_test.php @@ -1063,7 +1063,7 @@ public function test_post_tags(): void { /** * Ensure that all user data is deleted from a context. */ - public function test_all_users_deleted_from_context() { + public function test_all_users_deleted_from_context(): void { global $DB; $fs = get_file_storage(); @@ -1268,7 +1268,7 @@ public function test_all_users_deleted_from_context() { /** * Ensure that all user data is deleted for a specific context. */ - public function test_delete_data_for_user() { + public function test_delete_data_for_user(): void { global $DB; $fs = get_file_storage(); @@ -1483,7 +1483,7 @@ public function test_delete_data_for_user() { /** * Ensure that user data for specific users is deleted from a specified context. */ - public function test_delete_data_for_users() { + public function test_delete_data_for_users(): void { global $DB; $fs = get_file_storage(); diff --git a/mod/forum/tests/vaults_forum_test.php b/mod/forum/tests/vaults_forum_test.php index 71b1210fccd8..e240764f6e63 100644 --- a/mod/forum/tests/vaults_forum_test.php +++ b/mod/forum/tests/vaults_forum_test.php @@ -85,7 +85,7 @@ public function test_get_from_course_module_id(): void { * * @covers ::get_from_course_module_ids */ - public function test_get_from_course_module_ids() { + public function test_get_from_course_module_ids(): void { $this->resetAfterTest(); $vaultfactory = \mod_forum\local\container::get_vault_factory(); diff --git a/mod/h5pactivity/tests/external/get_h5pactivities_by_courses_test.php b/mod/h5pactivity/tests/external/get_h5pactivities_by_courses_test.php index 17e80c82bfc7..33908fccfa5f 100644 --- a/mod/h5pactivity/tests/external/get_h5pactivities_by_courses_test.php +++ b/mod/h5pactivity/tests/external/get_h5pactivities_by_courses_test.php @@ -48,7 +48,7 @@ class get_h5pactivities_by_courses_test extends externallib_advanced_testcase { /** * Test test_get_h5pactivities_by_courses user student. */ - public function test_get_h5pactivities_by_courses() { + public function test_get_h5pactivities_by_courses(): void { global $CFG, $DB; $this->resetAfterTest(); diff --git a/mod/lesson/tests/lib_test.php b/mod/lesson/tests/lib_test.php index 17a2e63ea76b..0f6e6406fc6d 100644 --- a/mod/lesson/tests/lib_test.php +++ b/mod/lesson/tests/lib_test.php @@ -827,7 +827,7 @@ public function test_mod_lesson_core_calendar_event_timestart_updated_unknown_ev /** * A LESSON_EVENT_TYPE_OPEN event should update the available property of the lesson activity. */ - public function test_mod_lesson_core_calendar_event_timestart_updated_open_event() { + public function test_mod_lesson_core_calendar_event_timestart_updated_open_event(): void { global $CFG, $DB; require_once($CFG->dirroot . "/calendar/lib.php"); @@ -887,7 +887,7 @@ public function test_mod_lesson_core_calendar_event_timestart_updated_open_event /** * A LESSON_EVENT_TYPE_CLOSE event should update the deadline property of the lesson activity. */ - public function test_mod_lesson_core_calendar_event_timestart_updated_close_event() { + public function test_mod_lesson_core_calendar_event_timestart_updated_close_event(): void { global $CFG, $DB; require_once($CFG->dirroot . "/calendar/lib.php"); $this->resetAfterTest(true); diff --git a/mod/quiz/tests/calendar_event_modified_test.php b/mod/quiz/tests/calendar_event_modified_test.php index 5e52b2774350..6caf143da6b3 100644 --- a/mod/quiz/tests/calendar_event_modified_test.php +++ b/mod/quiz/tests/calendar_event_modified_test.php @@ -273,7 +273,7 @@ public function test_student_role_cant_update_quiz_activity(): void { * able to update the quiz activity dates by changing the calendar * event. */ - public function test_teacher_role_can_update_quiz_activity() { + public function test_teacher_role_can_update_quiz_activity(): void { global $DB; $this->resetAfterTest(); diff --git a/mod/quiz/tests/local_structure_slot_random_test.php b/mod/quiz/tests/local_structure_slot_random_test.php index 039f159cea99..dd2a764ad4f6 100644 --- a/mod/quiz/tests/local_structure_slot_random_test.php +++ b/mod/quiz/tests/local_structure_slot_random_test.php @@ -226,7 +226,7 @@ public function test_set_tags_filter(): void { (array)json_decode($tagspropery)->filters->qtagids->values); } - public function test_insert() { + public function test_insert(): void { global $SITE; $this->resetAfterTest(); diff --git a/mod/scorm/tests/externallib_test.php b/mod/scorm/tests/externallib_test.php index c365adfdea54..3f7fbc5fa0aa 100644 --- a/mod/scorm/tests/externallib_test.php +++ b/mod/scorm/tests/externallib_test.php @@ -227,7 +227,7 @@ public function test_mod_scorm_get_scorm_attempt_count_invalid_userid(): void { /** * Test get scorm scoes */ - public function test_mod_scorm_get_scorm_scoes() { + public function test_mod_scorm_get_scorm_scoes(): void { global $DB; $this->resetAfterTest(true); diff --git a/mod/scorm/tests/lib_test.php b/mod/scorm/tests/lib_test.php index 8d85bad93d45..01fb3cd6d5ab 100644 --- a/mod/scorm/tests/lib_test.php +++ b/mod/scorm/tests/lib_test.php @@ -633,7 +633,7 @@ public function test_mod_scorm_core_calendar_event_timestart_updated_unknown_eve * A SCORM_EVENT_TYPE_OPEN event should update the timeopen property of * the scorm activity. */ - public function test_mod_scorm_core_calendar_event_timestart_updated_open_event() { + public function test_mod_scorm_core_calendar_event_timestart_updated_open_event(): void { global $CFG, $DB; require_once($CFG->dirroot . "/calendar/lib.php"); @@ -694,7 +694,7 @@ public function test_mod_scorm_core_calendar_event_timestart_updated_open_event( * A SCORM_EVENT_TYPE_CLOSE event should update the timeclose property of * the scorm activity. */ - public function test_mod_scorm_core_calendar_event_timestart_updated_close_event() { + public function test_mod_scorm_core_calendar_event_timestart_updated_close_event(): void { global $CFG, $DB; require_once($CFG->dirroot . "/calendar/lib.php"); diff --git a/mod/wiki/tests/privacy/provider_test.php b/mod/wiki/tests/privacy/provider_test.php index e39ef8d3feb5..2a442027468f 100644 --- a/mod/wiki/tests/privacy/provider_test.php +++ b/mod/wiki/tests/privacy/provider_test.php @@ -327,7 +327,7 @@ public function test_get_users_in_context(): void { /** * Export data for user 1 */ - public function test_export_user_data1() { + public function test_export_user_data1(): void { // Export all contexts for the first user. $contextids = array_values(array_map(function($c) { @@ -383,7 +383,7 @@ public function test_export_user_data1() { /** * Test export data for user 2 */ - public function test_export_user_data2() { + public function test_export_user_data2(): void { // Export all contexts for the second user. $contextids = array_values(array_map(function($c) { @@ -434,7 +434,7 @@ public function test_export_user_data2() { /** * Test export data for user 3 (locks, empty individual wiki) */ - public function test_export_user_data3() { + public function test_export_user_data3(): void { // Export all contexts for the third user. $contextids = array_values(array_map(function($c) { @@ -515,7 +515,7 @@ protected function add_comment($page, $text) { /** * Test export data when there are comments. */ - public function test_export_user_data_with_comments() { + public function test_export_user_data_with_comments(): void { global $DB; // Comment on each page in the first wiki as the first user. $this->setUser($this->users[1]); diff --git a/privacy/tests/moodle_content_writer_test.php b/privacy/tests/moodle_content_writer_test.php index 7b281a9ded7d..d718f70ca6cd 100644 --- a/privacy/tests/moodle_content_writer_test.php +++ b/privacy/tests/moodle_content_writer_test.php @@ -705,7 +705,7 @@ public function test_export_user_preference_context_block($component, $key, $val * * @covers ::export_user_preference */ - public function test_export_user_preference_context_block_multiple_instances() { + public function test_export_user_preference_context_block_multiple_instances(): void { $this->resetAfterTest(); $generator = $this->getDataGenerator(); @@ -1323,7 +1323,7 @@ public function rewrite_pluginfile_urls_provider() { ]; } - public function test_export_html_functions() { + public function test_export_html_functions(): void { $this->resetAfterTest(); $data = (object) ['key' => 'value']; diff --git a/question/tests/externallib_test.php b/question/tests/externallib_test.php index 002c87342713..f475cdd8dc46 100644 --- a/question/tests/externallib_test.php +++ b/question/tests/externallib_test.php @@ -195,7 +195,7 @@ public function test_get_random_question_summaries_variations( $includesubcategories, $usetagnames, $expectedquestionindexes - ) { + ): void { $this->resetAfterTest(); $context = \context_system::instance(); @@ -365,7 +365,7 @@ public function test_get_random_question_summaries_formats_returned_questions(): /** * get_random_question_summaries should allow limiting and offsetting of the result set. */ - public function test_get_random_question_summaries_with_limit_and_offset() { + public function test_get_random_question_summaries_with_limit_and_offset(): void { $this->resetAfterTest(); $numberofquestions = 5; $includesubcategories = false; diff --git a/question/type/calculated/tests/question_type_test.php b/question/type/calculated/tests/question_type_test.php index 271c60792b14..f638bcdb29e4 100644 --- a/question/type/calculated/tests/question_type_test.php +++ b/question/type/calculated/tests/question_type_test.php @@ -64,7 +64,7 @@ public function test_get_random_guess_score(): void { $this->assertEquals(0.1, $this->qtype->get_random_guess_score($q)); } - public function test_load_question() { + public function test_load_question(): void { $this->resetAfterTest(); $syscontext = \context_system::instance(); diff --git a/question/type/multianswer/tests/question_type_test.php b/question/type/multianswer/tests/question_type_test.php index 34485048c64b..6cc5a6aba2e5 100644 --- a/question/type/multianswer/tests/question_type_test.php +++ b/question/type/multianswer/tests/question_type_test.php @@ -148,7 +148,7 @@ public function test_get_random_guess_score_with_all_missing_subquestions(): voi $this->assertNull($this->qtype->get_random_guess_score($questiondata)); } - public function test_load_question() { + public function test_load_question(): void { $this->resetAfterTest(); $syscontext = \context_system::instance(); diff --git a/repository/contentbank/tests/search/search_test.php b/repository/contentbank/tests/search/search_test.php index 1ea14b9037f4..d2896bc2b155 100644 --- a/repository/contentbank/tests/search/search_test.php +++ b/repository/contentbank/tests/search/search_test.php @@ -47,7 +47,7 @@ class search_test extends \advanced_testcase { * @param string $search The search string * @param array $expected The array containing the expected content names that should be returned by the search */ - public function test_get_search_contents(array $contentnames, string $search, array $expected) { + public function test_get_search_contents(array $contentnames, string $search, array $expected): void { $this->resetAfterTest(); $admin = get_admin(); diff --git a/repository/dropbox/tests/api_test.php b/repository/dropbox/tests/api_test.php index ea4360068785..6aec039ce13b 100644 --- a/repository/dropbox/tests/api_test.php +++ b/repository/dropbox/tests/api_test.php @@ -339,7 +339,7 @@ public function test_fetch_dropbox_data_endpoint(): void { /** * Some Dropbox endpoints require that the POSTFIELDS be set to null exactly. */ - public function test_fetch_dropbox_data_postfields_null() { + public function test_fetch_dropbox_data_postfields_null(): void { $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class) ->disableOriginalConstructor() ->onlyMethods([ @@ -365,7 +365,7 @@ public function test_fetch_dropbox_data_postfields_null() { /** * When data is specified, it should be json_encoded in POSTFIELDS. */ - public function test_fetch_dropbox_data_postfields_data() { + public function test_fetch_dropbox_data_postfields_data(): void { $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class) ->disableOriginalConstructor() ->onlyMethods([ @@ -442,7 +442,7 @@ public function test_fetch_dropbox_data_recurse_on_additional_records(): void { /** * Base tests for the fetch_dropbox_content function. */ - public function test_fetch_dropbox_content() { + public function test_fetch_dropbox_content(): void { $mock = $this->getMockBuilder(\repository_dropbox\dropbox::class) ->disableOriginalConstructor() ->onlyMethods([ diff --git a/tag/tests/privacy/provider_test.php b/tag/tests/privacy/provider_test.php index 5394d27b940c..a07b1bb56065 100644 --- a/tag/tests/privacy/provider_test.php +++ b/tag/tests/privacy/provider_test.php @@ -250,7 +250,7 @@ public function test_delete_data_for_all_users_in_context(): void { $this->assertEquals(0, $DB->count_records('tag_instance', [])); } - public function test_export_data_for_user() { + public function test_export_data_for_user(): void { global $DB; list($user1, $user2) = $this->set_up_tags(); $context = \context_system::instance(); diff --git a/tag/tests/taglib_test.php b/tag/tests/taglib_test.php index 7a973515e7c9..96206f69bf45 100644 --- a/tag/tests/taglib_test.php +++ b/tag/tests/taglib_test.php @@ -325,7 +325,7 @@ protected function prepare_correlated() { /** * Test for function compute_correlations() that is part of tag cron */ - public function test_correlations() { + public function test_correlations(): void { global $DB; $task = new \core\task\tag_cron_task(); @@ -929,7 +929,7 @@ public function test_combine_tags(): void { /** * Testing function core_tag_tag::combine_tags() when related tags are present. */ - public function test_combine_tags_with_related() { + public function test_combine_tags_with_related(): void { $collid = core_tag_collection::get_default(); $context = \context_system::instance(); core_tag_tag::set_item_tags('core', 'course', 10, $context, array('Cat', 'Cats', 'Dog')); @@ -1014,7 +1014,7 @@ public function test_get_tags_by_area_in_contexts_empty(): void { * have instances in the given context even when there is only a single * instance. */ - public function test_get_tags_by_area_in_contexts_single_tag_one_context() { + public function test_get_tags_by_area_in_contexts_single_tag_one_context(): void { $tagnames = ['foo']; $collid = core_tag_collection::get_default(); $tags = core_tag_tag::create_if_missing($collid, $tagnames); @@ -1043,7 +1043,7 @@ public function test_get_tags_by_area_in_contexts_single_tag_one_context() { * that have tag instances in for the area in the given context and * should ignore all tags that don't have an instance. */ - public function test_get_tags_by_area_in_contexts_multiple_tags_one_context() { + public function test_get_tags_by_area_in_contexts_multiple_tags_one_context(): void { $tagnames = ['foo', 'bar', 'baz']; $collid = core_tag_collection::get_default(); $tags = core_tag_tag::create_if_missing($collid, $tagnames); @@ -1073,7 +1073,7 @@ public function test_get_tags_by_area_in_contexts_multiple_tags_one_context() { * Tags with tag instances in the same area with in difference contexts * should be ignored. */ - public function test_get_tags_by_area_in_contexts_multiple_tags_multiple_contexts() { + public function test_get_tags_by_area_in_contexts_multiple_tags_multiple_contexts(): void { $tagnames = ['foo', 'bar', 'baz', 'bop', 'bam', 'bip']; $collid = core_tag_collection::get_default(); $tags = core_tag_tag::create_if_missing($collid, $tagnames); @@ -1191,7 +1191,7 @@ public function test_get_items_tags_unknown_component_itemtype(): void { * 3 => [] * ] */ - public function test_get_items_tags_missing_itemids() { + public function test_get_items_tags_missing_itemids(): void { $user1 = $this->getDataGenerator()->create_user(); $user2 = $this->getDataGenerator()->create_user(); $user3 = $this->getDataGenerator()->create_user(); @@ -1232,7 +1232,7 @@ public function test_get_items_tags_missing_itemids() { * set_item_tags should remove any tags that aren't in the given list and should * add any instances that are missing. */ - public function test_set_item_tags_no_multiple_context_add_remove_instances() { + public function test_set_item_tags_no_multiple_context_add_remove_instances(): void { $tagnames = ['foo', 'bar', 'baz', 'bop']; $collid = core_tag_collection::get_default(); $tags = core_tag_tag::create_if_missing($collid, $tagnames); @@ -1312,7 +1312,7 @@ public function test_set_item_tags_no_multiple_context_updates_context_of_instan * the new set of tags, regardless of the context that the tag instance * is in. */ - public function test_set_item_tags_no_multiple_contex_deletes_old_instancest() { + public function test_set_item_tags_no_multiple_contex_deletes_old_instancest(): void { $tagnames = ['foo', 'bar', 'baz', 'bop']; $collid = core_tag_collection::get_default(); $tags = core_tag_tag::create_if_missing($collid, $tagnames); @@ -1361,7 +1361,7 @@ public function test_set_item_tags_no_multiple_contex_deletes_old_instancest() { * set_item_tags should not change tag instances in a different context to the one * it's opertating on if the tag area allows instances from multiple contexts. */ - public function test_set_item_tags_allow_multiple_context_doesnt_update_context() { + public function test_set_item_tags_allow_multiple_context_doesnt_update_context(): void { global $DB; $tagnames = ['foo', 'bar', 'bop']; $collid = core_tag_collection::get_default(); @@ -1414,7 +1414,7 @@ public function test_set_item_tags_allow_multiple_context_doesnt_update_context( * the new set of tags only in the same context if the tag area allows * multiple contexts. */ - public function test_set_item_tags_allow_multiple_context_deletes_instances_in_same_context() { + public function test_set_item_tags_allow_multiple_context_deletes_instances_in_same_context(): void { $tagnames = ['foo', 'bar', 'baz', 'bop']; $collid = core_tag_collection::get_default(); $tags = core_tag_tag::create_if_missing($collid, $tagnames); @@ -1458,7 +1458,7 @@ public function test_set_item_tags_allow_multiple_context_deletes_instances_in_s * set_item_tags should allow multiple instances of the same tag in different * contexts if the tag area allows multiple contexts. */ - public function test_set_item_tags_allow_multiple_context_same_tag_multiple_contexts() { + public function test_set_item_tags_allow_multiple_context_same_tag_multiple_contexts(): void { $tagnames = ['foo']; $collid = core_tag_collection::get_default(); $tags = core_tag_tag::create_if_missing($collid, $tagnames); @@ -1788,7 +1788,7 @@ public function test_delete_instances_with_component_and_context(): void { * delete_instances should delete all tag instances for a component, item type * and context if given the component, itemtype, and context id as parameters. */ - public function test_delete_instances_with_component_and_itemtype_and_context() { + public function test_delete_instances_with_component_and_itemtype_and_context(): void { global $DB; $tagnames = ['foo', 'bar', 'baz']; diff --git a/user/tests/userlib_test.php b/user/tests/userlib_test.php index bdb44dc87d39..9f5183717fde 100644 --- a/user/tests/userlib_test.php +++ b/user/tests/userlib_test.php @@ -984,7 +984,7 @@ public function test_user_get_user_details_permissions(): void { * Test user_get_user_details_groups. * @covers ::user_get_user_details */ - public function test_user_get_user_details_groups() { + public function test_user_get_user_details_groups(): void { $this->resetAfterTest(); // Create user and modify user profile.