diff --git a/admin/tool/behat/tests/manager_util_test.php b/admin/tool/behat/tests/manager_util_test.php index 98ccd03a85a34..71629550155e8 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 30942ca4b3d63..1e3e8d5bc2668 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 2d99e5c37acb2..f023b71840b85 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 6399314cf7748..72446a2e83414 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 eec0bd5397c49..32c4f56afa52c 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 0dc614a43a019..8ab891996326c 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 d2164cf443c70..0633984a8fbb6 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 085ce1b27f16c..86b8b37790ddd 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 @@ */ 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 d6d2a6c63d903..ad0e9920eab9c 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 @@ */ 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 1e23599a30c30..d324d79b139e9 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 @@ */ 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 1492718b0fb60..aeb15c6b61ea4 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 @@ private function disable_gc() { /** * 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 ae85b869a65ea..f69738759b6e4 100644 --- a/admin/tool/log/tests/privacy_test.php +++ b/admin/tool/log/tests/privacy_test.php @@ -51,7 +51,7 @@ */ 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 8511c842f2ba0..338bdebdcb617 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 c8db5c18ac7ac..b133672562329 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 b88a74261bfef..0ba834c70dd92 100644 --- a/admin/tool/messageinbound/tests/manager_test.php +++ b/admin/tool/messageinbound/tests/manager_test.php @@ -44,7 +44,7 @@ */ 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 e98c027a5b9f4..65d6869af7e12 100644 --- a/admin/tool/messageinbound/tests/privacy_test.php +++ b/admin/tool/messageinbound/tests/privacy_test.php @@ -46,7 +46,7 @@ */ 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 6e1da9c8e0772..c1469f457e384 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 f74c10b309c2e..35a90b449414e 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 4ed829d3f40ee..109bc7ff92bae 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 7c4ae86587d49..c2672a8c67f39 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 @@ public function test_create_history() { $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 3d419c7e4d5d9..871b11d5130e1 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 a5173faad34d9..fd334e61e50af 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 @@ public function test_get_rules_by_event() { $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 b3511b5e846f1..cb18815ad127c 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 b52678436e62f..10a5e98efa982 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 9de32269c36a0..5f0a13ca58f31 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 8abff00e52064..bec7faab688f2 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 c771cde1bdde7..6fa4a0d6c115d 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 0e24c311ca1cf..199fca063c23e 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 44f9db6cc0666..87c4e86db7680 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 c3ea0e6847773..c7be87b264fb2 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 642ee0c775a8a..b60247feacfea 100644 --- a/admin/tool/usertours/tests/accessdate_filter_test.php +++ b/admin/tool/usertours/tests/accessdate_filter_test.php @@ -36,7 +36,7 @@ */ 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 d5e4893ccf5c8..0deff0da644f6 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 @@ public function setUp() { /** * 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 940e517fc3ea0..8fe97394343a3 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 005272ee081f1..fb6a3c1d85fd5 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 @@ public function setUp() { /** * 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 c5bf23f012a0a..d1014f7d84710 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 @@ public function setUp() { /** * 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 00cfea336917e..13010f966455c 100644 --- a/analytics/tests/course_test.php +++ b/analytics/tests/course_test.php @@ -33,7 +33,7 @@ */ 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 f5c916c9ea333..fb600c8fb9a98 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 9d5bdd2b1e93b..a1004fb563f4f 100644 --- a/analytics/tests/model_test.php +++ b/analytics/tests/model_test.php @@ -41,7 +41,7 @@ */ 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 f3768788e0ffe..f8f2866dcb896 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 1fd9ac2a7242b..159bfd8346675 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 21fdd289757ed..d0fa280cda12c 100644 --- a/analytics/tests/privacy_test.php +++ b/analytics/tests/privacy_test.php @@ -44,7 +44,7 @@ */ 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 5054a3fb0405f..5d3cb030251ea 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 f62f95c11026d..ed1900a6dfd39 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 156a997fe942b..7857e34b17b15 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 55722915e4765..af741c3ee6533 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 7ecf9e6d8ad6c..b41db22fff8ac 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 d582d0a4dce44..1e190cf3e0fd1 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 237852ce6e5bf..f3f53d5feb63b 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 @@ public function setUp() { /** * 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 16701f26f8036..d3586d3f1bcb5 100644 --- a/auth/tests/privacy_test.php +++ b/auth/tests/privacy_test.php @@ -43,7 +43,7 @@ */ 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 b1a004093c6a7..02d8476b7754b 100644 --- a/availability/condition/completion/tests/condition_test.php +++ b/availability/condition/completion/tests/condition_test.php @@ -52,7 +52,7 @@ public static function setupBeforeClass(): void { /** * 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 7b62904e210ce..ae2b2a7c244e2 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 1c94323a7c380..2f7d61847492e 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 94cd4ec3301d5..5f5f7769dce88 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 e2250e22d0683..c6dc98dda3ad7 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 e8044df138013..befd3fff4c0f8 100644 --- a/availability/tests/info_test.php +++ b/availability/tests/info_test.php @@ -36,7 +36,7 @@ * @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 1b131a9a96eae..2760c5896d620 100644 --- a/availability/tests/tree_test.php +++ b/availability/tests/tree_test.php @@ -35,7 +35,7 @@ * @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 f638be031aa29..5c93fb60e21bb 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 68589da269250..7065286efdb0d 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 @@ protected function setUp() { ); } - 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 5a609c85d03d0..d8397e06a3533 100644 --- a/backup/moodle2/tests/backup_encrypted_content_test.php +++ b/backup/moodle2/tests/backup_encrypted_content_test.php @@ -31,7 +31,7 @@ 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 554aa0be8fb10..658f6c1bd4d80 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 9ac514f97dc47..c76d9529f3d83 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 906dbfe51c4b2..40f216853e976 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 @@ public function test_malformed_instantiation() { $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 8cb6e4d3a6a73..df2b1539c4e77 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 @@ public function test_submit_copy_form() { $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 8e4ced3e7e3cd..3b8904358a1d6 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 219b530465326..7a18eb0fae49a 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 2a3fa1a55eb67..7cebfc56c5609 100644 --- a/backup/util/factories/tests/factories_test.php +++ b/backup/util/factories/tests/factories_test.php @@ -40,7 +40,7 @@ */ class backup_factories_testcase extends advanced_testcase { - function setUp() { + public function setUp(): void { global $CFG; parent::setUp(); @@ -57,7 +57,7 @@ function setUp() { /** * 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 ea5ab2cc0e2bc..a5239a10c3e39 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 3e9b2feb1f73a..a02573689b76c 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 8b9f6e179974a..78d1a0c18043a 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 40ee6ead97cfb..3cb0bef732f78 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 93a51a7c62734..3b9b807bcea95 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 c4ec0e1acf697..0dac8de034844 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 0be15261f096a..7b36cae7a5738 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 8067b4ef1a51e..12b8638c5ee89 100644 --- a/badges/tests/privacy_test.php +++ b/badges/tests/privacy_test.php @@ -48,7 +48,7 @@ */ 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 1e7aae4b73193..55db08c694f0d 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 363245d999b40..1962cc13d6d0e 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 da436ac5a4a42..9f56f5fc81d04 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 fcc0eb25c56a8..6600709b20c69 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 @@ public function test_item_delete_record_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 68035eface72d..b3e9c1b739f2a 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 20df9d9fecb4d..4695a70d17c11 100644 --- a/blocks/tests/privacy_test.php +++ b/blocks/tests/privacy_test.php @@ -44,7 +44,7 @@ */ 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 87f265dfeb35c..e6105c8e3eb4f 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 5e23d5f827cee..7887a69395463 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 a690e6346a310..f1ad92191869a 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 700255291da39..67de624c045b3 100644 --- a/blog/tests/privacy_test.php +++ b/blog/tests/privacy_test.php @@ -47,7 +47,7 @@ */ 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 4903d3bbb3d9b..108015b68e9fd 100644 --- a/cache/stores/apcu/tests/apcu_test.php +++ b/cache/stores/apcu/tests/apcu_test.php @@ -45,11 +45,11 @@ protected function get_class_name() { 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 @@ public function test_different_caches_have_different_prefixes() { $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 7f8876e301e82..b7178b3c33628 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 1fa3861b5c782..a4bd9f79425e1 100644 --- a/cache/stores/redis/tests/redis_test.php +++ b/cache/stores/redis/tests/redis_test.php @@ -54,13 +54,13 @@ protected function get_class_name() { 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 @@ public function test_lock() { $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 146efe34abc07..b392114fb515f 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 @@ public function setUp() { /** * 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 faafe51449d82..ffbb1dfd53e9b 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 @@ public function setUp() { /** * 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 12b6291ed759e..8fa28d737c716 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 @@ public function setUp() { /** * 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 0eee86e377fc8..b266f4e1d699a 100644 --- a/cache/tests/fixtures/stores.php +++ b/cache/tests/fixtures/stores.php @@ -46,7 +46,7 @@ abstract protected function get_class_name(); * 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 @@ public function run_tests(cache_store $instance) { $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 859acc6f19734..487010b286986 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 bc72391ce389c..7e00429f27099 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 f0799db5347e2..0238db8047ee2 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 76f8374effc64..fdb852ce80a79 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 1d41b310bcb51..d39596d9e8349 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 4467337ce955e..d39012581cf44 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 70f56d976661f..987de7b3915b0 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 2b7157d5dc258..d2173b79a8079 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 a6e2531e658d1..3af4655cb8c2a 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 dc9f25e3efbd3..5d175ac5e957c 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 71a70804eab60..c6c04bc9a72d4 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 b9473923d5476..ea79b8bdded1b 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 b2f7ba2d7eb92..45e2093258c7e 100644 --- a/comment/tests/privacy_test.php +++ b/comment/tests/privacy_test.php @@ -38,7 +38,7 @@ */ 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 83247d136a561..c2ddd7af69876 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 7105753f50d88..4ba3a69b1550f 100644 --- a/competency/tests/privacy_test.php +++ b/competency/tests/privacy_test.php @@ -48,7 +48,7 @@ */ 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 af24c079a8416..984393e70b064 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 fded21991e354..2ea3061a0f8fb 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 6e737d6ba15aa..5d833b126644d 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 52af5f710d769..4a5cb9a6f97dd 100644 --- a/course/tests/category_hooks_test.php +++ b/course/tests/category_hooks_test.php @@ -37,7 +37,7 @@ */ 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 8d8b26be76583..5d463dec0d171 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 2673208d4e24b..64d5ba00460ce 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 0a30f7e55ef1b..c3a96186fb913 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 015632f7d08a7..648463db37651 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 6d03d4852d4e2..f438ee1dac65d 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 4d945332990c5..9a64267af10a2 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 749872287e0a0..4d52f3bafaf28 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 @@ public function test_parse_value(string $value, int $expected) { 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 6def88cfa66f6..937c2b86d1580 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 @@ public function test_parse_value(string $value, int $expected) { 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 8f625641ef286..b52d5a0685aa4 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 a5cc62d3ccb0c..9c48ad6e24e2a 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 2619389177c33..0b99cfc0906e7 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 b0b783a6e3f4c..bbf3e25cd0065 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 b01009e6c670f..48cb7f0e4835d 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 a601cf7f9d81e..75a79cd320948 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 3e478660c9bb2..5e9873d339864 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 984684cb1ca4b..dfcaf07dc2ddd 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 f9061bf6d1663..e39ec7aaf6193 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 5e673ec720f42..c05987b5ba0b8 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 f107787130923..25b63042b42ab 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 6954ff37c9f44..11c4146d410bf 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 4009101fbf528..64b63f37793c8 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 @@ public function test_unassign_roles() { $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 b4440073aaad9..cb56a431049be 100644 --- a/favourites/tests/component_favourite_service_test.php +++ b/favourites/tests/component_favourite_service_test.php @@ -33,7 +33,7 @@ */ 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 750768909355e..d7fe912b9b3b8 100644 --- a/favourites/tests/privacy_test.php +++ b/favourites/tests/privacy_test.php @@ -37,7 +37,7 @@ */ 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 b95451a12e2c0..d06868a379e14 100644 --- a/favourites/tests/repository_test.php +++ b/favourites/tests/repository_test.php @@ -36,7 +36,7 @@ */ 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 be372f1758334..f44a6386e0f74 100644 --- a/favourites/tests/user_favourite_service_test.php +++ b/favourites/tests/user_favourite_service_test.php @@ -33,7 +33,7 @@ */ 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 529b9ec415eab..fbb8a7bdb709e 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 467118cea2c99..cb9b3c4f7906e 100644 --- a/filter/displayh5p/tests/filter_test.php +++ b/filter/displayh5p/tests/filter_test.php @@ -36,7 +36,7 @@ */ class filter_displayh5p_testcase extends advanced_testcase { - public function setUp() { + public function setUp(): void { parent::setUp(); $this->resetAfterTest(true); @@ -96,4 +96,4 @@ public function texts_provider() { "\"[^>]*?>#"] ]; } -} \ No newline at end of file +} diff --git a/filter/multilang/tests/filter_test.php b/filter/multilang/tests/filter_test.php index 2dbefa2c8219b..65d8ce3771606 100644 --- a/filter/multilang/tests/filter_test.php +++ b/filter/multilang/tests/filter_test.php @@ -34,7 +34,7 @@ */ 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 1b03725f347ab..02dc2b1b2182f 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 67ce658438508..b2e9792074938 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 @@ public function test_logging() { $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 e2e7d7bed748c..3bc0b49e3c29a 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 @@ public function test_logging() { $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 fcada0d9e1c0f..277481f3f2bc1 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 @@ public function test_logging() { $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 b88d953126dd6..2e8263290e5c5 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 @@ public function test_logging() { $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 f05e8b5e311e5..b49d16e00bd3b 100644 --- a/grade/import/csv/tests/load_data_test.php +++ b/grade/import/csv/tests/load_data_test.php @@ -64,7 +64,7 @@ class gradeimport_csv_load_data_testcase extends grade_base_testcase { /** @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 2be84b674bc0a..5c8b7a5ba55ba 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 1301c0d84dcda..592c0192307bb 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 7af1a71dac210..f1ff2e815ab14 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 b44f8bff3784c..49a5425963f15 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 5789fcd3f4832..1cf7e15ca9b00 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 5c8a50b4eef42..05494286f5675 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 @@ public function test_execute_store_graded(): void { * @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 d9c2d485450b3..d721dee8f5216 100644 --- a/grade/tests/privacy_test.php +++ b/grade/tests/privacy_test.php @@ -46,7 +46,7 @@ */ 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 13f46c9d8611a..04ab135033fdb 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 1dd6b8cacd6d8..8e3e220a8b312 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 c2c65f5766f8f..89d8ca94104a2 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 75a7671b3489d..73eb2644b253b 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 42f1aea2d34f3..e2a842ac77df4 100644 --- a/h5p/tests/external_test.php +++ b/h5p/tests/external_test.php @@ -46,7 +46,7 @@ */ 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 13883c1c40b9b..9e5c4492567ad 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 05be9670cd663..b43df426dbb7a 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 d441fdc4c193a..a1bcb2c6cce67 100644 --- a/h5p/tests/h5p_core_test.php +++ b/h5p/tests/h5p_core_test.php @@ -40,7 +40,7 @@ */ 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 8cce6c2ed8cba..8199d353ac997 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 d553bd8938ab6..f1a8a933ef5b5 100644 --- a/iplookup/tests/geoip_test.php +++ b/iplookup/tests/geoip_test.php @@ -35,7 +35,7 @@ * 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 79466bc0122da..3ebe8b4fc7db1 100644 --- a/iplookup/tests/geoplugin_test.php +++ b/iplookup/tests/geoplugin_test.php @@ -31,7 +31,7 @@ */ 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 87a39b7b9040a..4a2eca7a10aaf 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 @@ protected function setUp() { 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 852b9e9513315..35526acdf4ebe 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 e23a456d57308..d55c8094dead6 100644 --- a/lib/dml/tests/dml_test.php +++ b/lib/dml/tests/dml_test.php @@ -27,7 +27,7 @@ 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 690d128303132..53a2ff1d32e00 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 @@ protected function init_db($fetchbuffersize) { /** * 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 bab70450a55dc..17b58df1034e8 100644 --- a/lib/dml/tests/recordset_walk_test.php +++ b/lib/dml/tests/recordset_walk_test.php @@ -35,7 +35,7 @@ */ 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 8736d795b8e3a..e5f08e8ed9da7 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 @@ */ 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 2959646fc1f9c..064140854bf3e 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 525d7706ae249..24653715fb639 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 @@ public function setUp() { /** * 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 387d047aecd01..4858c1c7c9616 100644 --- a/lib/filestorage/tests/file_system_test.php +++ b/lib/filestorage/tests/file_system_test.php @@ -39,11 +39,11 @@ */ 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 4b36265e2b958..56fd859c829de 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 12934141c6894..96052209f2b30 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 ec452128254ec..6e635b35a9708 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 e2203a29d5a80..16050c828d21b 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 63a99d4d8020c..a255208276aee 100644 --- a/lib/phpunit/classes/database_driver_testcase.php +++ b/lib/phpunit/classes/database_driver_testcase.php @@ -67,7 +67,7 @@ final public function __construct($name = null, array $data = array(), $dataName $this->setRunTestInSeparateProcess(false); } - public static function setUpBeforeClass() { + public static function setUpBeforeClass(): void { global $CFG; parent::setUpBeforeClass(); @@ -101,7 +101,7 @@ public static function setUpBeforeClass() { self::$extradb = $d; } - protected function setUp() { + protected function setUp(): void { global $DB; parent::setUp(); @@ -112,7 +112,7 @@ protected function setUp() { } } - 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 @@ protected function tearDown() { 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 bc80ae79af7e3..48d0412118d17 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 @@ protected function get_diff() { 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 04b75c5caee84..9ef7e1d995b1e 100644 --- a/lib/phpunit/tests/basic_test.php +++ b/lib/phpunit/tests/basic_test.php @@ -37,7 +37,7 @@ 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 18b459463a245..4ce4ca9d2a466 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 @@ protected function setUp() { 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 96fb1ce8b7c2a..fb92f8e013be0 100644 --- a/lib/tests/antivirus_test.php +++ b/lib/tests/antivirus_test.php @@ -29,7 +29,7 @@ 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 @@ protected function setUp() { 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 1cf455261c91f..4fbd0a64416fb 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 @@ protected function setUp() { $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 6b0998768070f..a880f9b0ff60c 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 7fb9eddb158bf..94604fec86262 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 @@ protected function setUp() { /** * 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 f66a69daab1a0..0111d66967233 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 @@ public function setUp() { $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 c7e925bf7f523..5feb310d138b2 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 @@ public function test_replace_sources() { $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 55e84d14e6752..7d7523b8c6d9e 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 eaa2f3c888e30..7dcd228f7f294 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 0e381b9e6d382..70a9f587aaa1b 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 20c7517d8467f..5604bd8fe29c5 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 b6aeae790d302..e5fc29796839b 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 93e6d7d045d79..8e1fe8da262ab 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 3cf66ded4a1ba..e2bb7867fa27f 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 b60f301a64903..82154e7dcae4b 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 b0eb08497a1b0..e30e30ab03368 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 9fc766aa1d63a..fe1d24a65f7a3 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 b56cd130655cb..7b227577920d2 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 aa8101f3f4e2b..3d91acd1997c2 100644 --- a/lib/tests/externallib_test.php +++ b/lib/tests/externallib_test.php @@ -32,11 +32,11 @@ 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 8875c3c87d5e1..edc6d1df77b26 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 3502a1bf2851b..00ac6183d2788 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 @@ */ 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 2064621b2d36d..d7c321112238b 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 8b230c94b1b39..d92ba7a464f25 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 @@ public function get_players_test($manager) { } 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 bd68624333e79..0159a6c5bec49 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 6cb5dc91be39a..20476c0d695fc 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 50d5adcd4780f..33078fe8d378f 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 @@ public function setUp() { * 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 9446e2a5aec83..711903e1c9822 100644 --- a/lib/tests/persistent_test.php +++ b/lib/tests/persistent_test.php @@ -34,7 +34,7 @@ */ 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 009c57eae5fd4..41a7957244c87 100644 --- a/lib/tests/plugin_manager_test.php +++ b/lib/tests/plugin_manager_test.php @@ -34,7 +34,7 @@ */ 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 d5b805fa9928d..e8f5566171710 100644 --- a/lib/tests/plugininfo/base_test.php +++ b/lib/tests/plugininfo/base_test.php @@ -50,7 +50,7 @@ public static function setUpBeforeClass(): void { /** * 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 3b79c46dac753..0ffa10cfe7799 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 c724f6a53b80e..0db975b54a441 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 cadbc3b5a3446..46373d61acee9 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 @@ public function setUp() { $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 7af80e024f8f3..7e45f9acbaba2 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 d2c43b241a442..4ae0a661311d9 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 @@ public function setUp() { /** * 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 d4f4e12de8b46..39b86cd07297e 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 d36f9b97b1826..646bbf48d3d0e 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 6777f1f9caf49..ecfd86be462e6 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 28a3b0031a359..9765e9127edfd 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 90e5000e64a2b..e6547a90fcdcd 100644 --- a/lib/xapi/tests/external/post_statement_test.php +++ b/lib/xapi/tests/external/post_statement_test.php @@ -64,7 +64,7 @@ public static function setupBeforeClass(): void { /** * 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 7dfe8e4f1ff0d..15e0ccdf51ee0 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 3def9af83afbb..c4a20c1d715bd 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 f7b053fc69314..d072e33ff3848 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 aa8de9f56ee0e..c9069347eb49b 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 3f4dcbf33c68a..125e40fb5ccf8 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 5c9d851731f02..b5f298e11245e 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 d0d3a54b668c1..a4fbbf8524501 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 96bd3478801e2..22cc63d99cbe8 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 dbfd9ba18a0ca..700c919bfc1b2 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 99e16cf8e4860..1475b275a05a4 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 1d51f6a44fa83..069e5f6cbd533 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 94fe0dbc42a97..26da55f692cb2 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 00a6b19fae24a..0ec24ea9c5d5b 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 4fd7e6ea49dfe..c21c311fdc892 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 7b27d56ba1f3e..2bfa83e0986be 100644 --- a/message/tests/helper_test.php +++ b/message/tests/helper_test.php @@ -39,7 +39,7 @@ */ 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 e07b2f78c594a..6db7eb4ab66da 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 5a75739fffd97..7d195e7e1af5d 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 a480e70e21372..704396b669d05 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 c8f53ac366e43..7e59a281eb8ff 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 eb42216cb2eeb..91a0a6e466870 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 005e0e38b0f74..795ec779845c2 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 @@ protected function insert_mnetservice_enrol_courses($remoteid) { $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 451a1c6085f90..599342bdeb4e9 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 af07abe51b921..cfd355eb84a88 100644 --- a/mod/assign/feedback/editpdf/tests/privacy_test.php +++ b/mod/assign/feedback/editpdf/tests/privacy_test.php @@ -39,7 +39,7 @@ */ 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 d30f98986c5fa..3212fe376974d 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 cd95aea24e3aa..dbda184662175 100644 --- a/mod/book/tests/events_test.php +++ b/mod/book/tests/events_test.php @@ -36,7 +36,7 @@ */ 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 247f29dda9319..283997673f51c 100644 --- a/mod/book/tests/lib_test.php +++ b/mod/book/tests/lib_test.php @@ -39,7 +39,7 @@ */ 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 65e15896ba30e..03bfd1e05d392 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 3132a41fb0eab..91e16c70ce897 100644 --- a/mod/book/tool/exportimscp/tests/events_test.php +++ b/mod/book/tool/exportimscp/tests/events_test.php @@ -36,7 +36,7 @@ */ 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 1ab755f4ac99b..d0ccb051c9514 100644 --- a/mod/book/tool/importhtml/tests/locallib_test.php +++ b/mod/book/tool/importhtml/tests/locallib_test.php @@ -38,7 +38,7 @@ */ 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 da071e58bb108..23c8a411bfa7d 100644 --- a/mod/book/tool/print/tests/events_test.php +++ b/mod/book/tool/print/tests/events_test.php @@ -36,7 +36,7 @@ */ 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 7a864cfecb3fa..14cf9852bed5b 100644 --- a/mod/chat/tests/lib_test.php +++ b/mod/chat/tests/lib_test.php @@ -35,7 +35,7 @@ */ 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 e3b4d9b908c92..12669f46b6a8b 100644 --- a/mod/chat/tests/privacy_test.php +++ b/mod/chat/tests/privacy_test.php @@ -47,7 +47,7 @@ */ 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 41fb362ab11f7..c12258208b465 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 e076cf9841859..517d27bac42f6 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 272d3a01aa7bf..9835201886f0c 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 c49c9be96fb69..815744c5b60ff 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 ab5c826d88108..aaa45572dbde7 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 84e8a7b4470da..ef43165c1134d 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 31d7c7bee80a0..c2b8ea39b70cb 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 8988ea6707438..ceab97ed02352 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 4d6fe2318afd1..7d6382f2eb5e0 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 d920b9b84ac75..8f4c715b8267b 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 248eef8d64094..068a1eafb9aa3 100644 --- a/mod/feedback/tests/privacy_test.php +++ b/mod/feedback/tests/privacy_test.php @@ -46,7 +46,7 @@ */ 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 71723dc7e12ad..c14bb5331bc3d 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 5a42f632fcc8a..9ee17e68694fa 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 @@ public function setUp() { * 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 0c9f751fcb7be..905f225f2a28c 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 a8875bb3c0b69..f740ffbb81a58 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 @@ public function setUp() { /** * 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 bf54d50d6407a..01b203ae8e74d 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 @@ public function setUp() { $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 7290395fc85db..d31d1499a49bf 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 @@ public function setUp() { /** * 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 2430f272e5865..ed523db916827 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 @@ protected function setUp() { 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 8a4e20fc4038b..0031d05a33128 100644 --- a/mod/forum/tests/generator_test.php +++ b/mod/forum/tests/generator_test.php @@ -36,13 +36,13 @@ */ 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 1cf30d536c838..e0635e897804f 100644 --- a/mod/forum/tests/lib_test.php +++ b/mod/forum/tests/lib_test.php @@ -31,13 +31,13 @@ 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 904151f01cdaa..f7e24390d59f3 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 @@ public function setUp() { $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 9902a29c0ec4e..26dc9d1554bee 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 @@ public function setUp() { $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 efd8019c6e224..0bcae0f98ec86 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 @@ public function setUp() { /** * 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 d0064df25886c..a5301839d0ca0 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 @@ public function setUp() { /** * 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 ac7ff4ed39cd7..047849eec13dc 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 27a47ce664b99..f22cc7e34ec87 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 @@ public function setUp() { /** * 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 3e4795250ab54..2710d1bc3c73c 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 @@ public function setUp() { $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 93095aab95e31..68d33cad9f94a 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 df894958ce712..44595635e810a 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 @@ public function setUp() { /** * 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 cac34353532b8..68bdabe241aae 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 3a575d939a09f..3b27cc9f392e1 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 de7838c0dd2de..0057e6047d309 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 @@ public function setUp() { /** * 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 d0101555eed5d..2d30141ab6000 100644 --- a/mod/glossary/tests/events_test.php +++ b/mod/glossary/tests/events_test.php @@ -35,7 +35,7 @@ */ 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 d763fc78ac063..6664e2f3b4b79 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 cf8ddbe04bdba..b8f7bc64d521b 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 20d581641ee4d..649fafd332018 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 @@ private function create_action_event($courseid, $instanceid, $eventtype) { 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 cbb1288b93124..74526fb661b5b 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 9524649151685..a34be9b77ae87 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 0cd6c23a49f20..12aa9b6c5cf66 100644 --- a/mod/lesson/tests/privacy_test.php +++ b/mod/lesson/tests/privacy_test.php @@ -44,7 +44,7 @@ */ 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 d24c59c8f123c..0f75ec201b38e 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 c9ed00414b6e4..489aff04c6e8f 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 a2e8d87e623ea..898867417714c 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 f56dc8330e221..f9f72f504303d 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 564b5cff869ca..71d1e23fed02e 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 5af37f0820461..df063ce7f9a12 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 e93d723f6c0e1..2932d15902748 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 eefa5b95f7b5b..6952ec010ce33 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 dc01aa3faa133..049ea298d0e52 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 354b310649f91..ab4ef7afe99ff 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 @@ public function test_event_create_template() { $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 aa2091e8488e6..6d61979a70626 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 d01b7e556a867..1e7c3946ec31c 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 a7db893d6c017..89c408e7036d9 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 @@ private function get_seb_config_download_link() { */ 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 9cbb5588281be..0be6b6d4fa0ce 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 6de933da16ff5..0ea6a4eda6f97 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 f82c20cd0d1d1..9623b5d9bbfb4 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 da21c0551a2a5..44f10c2f43e8f 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 787b815bbbf75..d1de43cfca638 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 c5d04dd388471..d52b96c4a19a7 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 ff06ce5765850..0a57cbe1dbf42 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 80c63d2ce4619..1e6951367bf38 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 90ae77e8eb718..148598145b133 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 bf44adf56bf00..24e41b295a62f 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 b6ac0fddf758e..79d8f52975340 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 bc6971f34fec7..55e3d198ab2bf 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 f33791ed56d77..ae0ebbb6f1007 100644 --- a/mod/scorm/tests/locallib_test.php +++ b/mod/scorm/tests/locallib_test.php @@ -39,7 +39,7 @@ */ 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 433b4d3f71536..3202026980224 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 30de66b68ece8..1a086ac8ac176 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 069e88d7acdd4..43c682a15ca17 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 75ea2f2fe0a47..95f887e54bdf8 100644 --- a/mod/survey/tests/privacy_test.php +++ b/mod/survey/tests/privacy_test.php @@ -47,7 +47,7 @@ */ 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 50198f03e819b..fb0c7f0f04174 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 @@ private function create_action_event($courseid, $instanceid, $eventtype) { 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 b7cf118458c11..2714ab263ee01 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 522cfbe44a76b..c5303cf7d4ece 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 b2699e46987b2..e28f6db15880d 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 9c3f9078fc671..a7d1171542cf1 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 9beeff1a7dd27..f04fc98580ef2 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 @@ protected function setUp() { $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 a11f5bb394af4..8a02ca65465be 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 @@ protected function setUp() { $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 e61d73b0402f0..42b23e13852ee 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 @@ protected function setUp() { $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 d350b55dc8f5d..f11258d01fdd7 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 @@ protected function setUp() { $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 adb8d663b1cbf..a83c5de2e5422 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 @@ protected function setUp() { } - 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 ea86df9462eaa..f590bef4b8835 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 @@ protected function setUp() { $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 1338a51e167fb..7b5940c35e864 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 a81ea0f8b1ff5..0e12a86c73e75 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 @@ protected function setUp() { $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 f93805e014c9c..958694bfbb6dd 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 @@ protected function setUp() { /** * 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 a59388deea89e..7a093845aa848 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 3fe006a23f684..f5d0a37475b38 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 02d5dbe703473..655fb28e5f393 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 69b0001967be2..db21796e16b03 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 @@ public function test_core_notes_myprofile_navigation_notes_disabled() { $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 92b30b5162150..c4405041a79e7 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 eb1a0551df7c9..d395091baf0b3 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 be8bb465cca95..47960afd270d3 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 58cd548ec3936..82951113920fe 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 5a91a25bb95b3..f8d7fedcd46da 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 a4892e6247e11..5fdff4959b300 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 3bedc80fd53ff..9bb1eff7927a4 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 8c137599f9e8a..6c4ca9ee2bdd3 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 2d9b5cafdeb5f..354dccd4b444f 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 e8f56cca71e44..35c9e7d1fa540 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 36af6bb734c58..7f4eab7a9575a 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 0ce525310a60d..ed5f20e1f32d1 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 b0a987b0f55ae..0ba9aff59469d 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 3fd521452073f..34d092f541831 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 13d48b93fff18..df59c5eec3d77 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 @@ protected function setUp() { 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 7047a41a0a2e8..6ef1436fd3583 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 b5194c008ac1e..7849943591f1e 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 @@ protected function setUp() { } } - 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 81f20cab8e034..5453567e3b1cb 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 @@ protected function setUp() { $this->iterator = $this->quba->get_attempt_iterator(); } - protected function tearDown() { + protected function tearDown(): void { $this->quba = null; $this->iterator = null; } @@ -122,4 +122,4 @@ public function test_cannot_set() { 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 9d90654b65ad4..543282c6db307 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 @@ protected function setUp() { $this->iterator = $this->qa->get_step_iterator(); } - protected function tearDown() { + protected function tearDown(): void { $this->qa = null; $this->iterator = null; } @@ -141,4 +141,4 @@ public function test_cannot_set() { 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 6ca87f43ad8c7..a5d9f977293cf 100644 --- a/question/engine/tests/questionusage_autosave_test.php +++ b/question/engine/tests/questionusage_autosave_test.php @@ -747,7 +747,7 @@ public function test_autosave_and_regrade_then_display() { $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 3756dc594e561..af86f114e422d 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 @@ protected function setUp() { $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 b7614dbec0447..7967ae2b324f6 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 4bfaf200950c8..adbe41cea3af5 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 0f93b8605f92d..bc03892bad5ad 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 523198ec2dc6a..2315ae2afd6c9 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 1292760e43cda..46fcb70c31af3 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 3f4ca511eed32..35483c6732af3 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 0c36e33b8581c..8b6fbf52b362c 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 8bd3692113e51..664577c21ac0c 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 ca7f562f0bd5e..2f650ca0b2549 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 60da13ef1c87f..b2444800ceea3 100644 --- a/question/type/description/tests/questiontype_test.php +++ b/question/type/description/tests/questiontype_test.php @@ -41,11 +41,11 @@ 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 1a34c3ab0e949..3dc8767bed699 100644 --- a/question/type/essay/tests/questiontype_test.php +++ b/question/type/essay/tests/questiontype_test.php @@ -39,11 +39,11 @@ 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 88ccadf28af63..6598983ead60e 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 baaf44daa215d..0da8cacb2192f 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 2261634745320..eb8e6071d4b18 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 4c9f1980f6c81..c18ead0627c63 100644 --- a/question/type/multichoice/tests/questiontype_test.php +++ b/question/type/multichoice/tests/questiontype_test.php @@ -40,11 +40,11 @@ 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 90a087e0f2212..9a39cde39f4b3 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 289966fdc1533..38a38d29f6179 100644 --- a/question/type/random/tests/questiontype_test.php +++ b/question/type/random/tests/questiontype_test.php @@ -40,11 +40,11 @@ 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 2bfa9a90a8284..71ec1fe72fb8e 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 569d5f24a9add..5f1967f6e7b7a 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 @@ public function compare_response_with_answer(array $response, question_answer $a * @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 5f1a639f872f1..1408a443cc6ee 100644 --- a/question/type/truefalse/tests/questiontype_test.php +++ b/question/type/truefalse/tests/questiontype_test.php @@ -41,11 +41,11 @@ 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 1468d59e93cae..4ffed3b578009 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 c066978da5726..896a8bfcc4c5f 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 a2b2dac43da5c..b18bd5ca74864 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 0426838aa18f4..67b36ac202e58 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 d35bc04c792a3..4ba92c1f0c04c 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 df95829007e54..a5dd4676665a5 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 fa9f20811f027..4d7bb49e1d16f 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 f002176c5b08a..53288e1014022 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 74bd64b54eff6..564dded59ae71 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 cd935ecdb76c2..a4df67695cb5c 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 6bade9193b72d..03ea06bb5df73 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 c86476be86ba0..71d1bba2648fa 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 178adefd762fc..78a98cf049adf 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 @@ protected function delete_endpoints($endpointname) { } } -} \ No newline at end of file +} diff --git a/repository/nextcloud/tests/lib_test.php b/repository/nextcloud/tests/lib_test.php index c8f3ec36c7491..cf6fe64f5a16f 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 a96691b8953b4..a22747ce1e859 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 afd258938b96f..fd39f1e68b234 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 080999b2eae56..66160d4294d53 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 736d55187f2af..9340baecace13 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 070b2abffbdfa..c49c24e202f2a 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 5ec0a699fddd0..7c51dab6714d2 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 @@ public function setUp() { * * @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 f88830c650100..23b1d31059abe 100644 --- a/search/engine/simpledb/tests/privacy_test.php +++ b/search/engine/simpledb/tests/privacy_test.php @@ -41,7 +41,7 @@ */ 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 @@ public function setUp() { * * @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 0acc303b3be80..8c9f4917d79d7 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 @@ public function setUp() { $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 8f99a292d281a..c58719911bee4 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 @@ public function 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/base_test.php b/search/tests/base_test.php index f55ac434964ab..f0a2ff17786e0 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 @@ public function setUp() { $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 d74a2aab592ad..c60acba18e427 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 @@ public function test_get_and_set_doc_icon() { $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 4fdba57f5a5a6..4ccd556a14abd 100644 --- a/search/tests/engine_test.php +++ b/search/tests/engine_test.php @@ -38,7 +38,7 @@ */ 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 fd4fc411b3821..8f0a51401d935 100644 --- a/search/tests/external_test.php +++ b/search/tests/external_test.php @@ -35,7 +35,7 @@ */ 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 562232e1f99a8..e042e28c7759a 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 @@ public function setup() { /** * 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 4cc4162b74c2d..27ed476adbb97 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 6c15e829d3840..00e4d01d98644 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 2fe96fafd73f5..28c62f9b7cb00 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 a1a3d1f5b0929..9f4862e84bbee 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 ce789d29ecc28..d18026e044a7f 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 208eab214d070..ff399ebb7d6d9 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 57e3f3461f851..a5c35d5ff1cf5 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 52347f43964b1..5ed8bb49b61ff 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 710681d5fd81f..0cf7d23b0d91c 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 955d49b1fcf82..467340a72719a 100644 --- a/webservice/tests/events_test.php +++ b/webservice/tests/events_test.php @@ -35,7 +35,7 @@ */ 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 fe56e7505634f..1fe5fcc0eb891 100644 --- a/webservice/tests/externallib_test.php +++ b/webservice/tests/externallib_test.php @@ -30,7 +30,7 @@ */ 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 59d741c74152c..407556b0dda0f 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 d7b4da0ec0069..d18f18fef4067 100644 --- a/webservice/tests/privacy_test.php +++ b/webservice/tests/privacy_test.php @@ -47,7 +47,7 @@ */ 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 c97c36f107696..32862a77d639a 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 ad99cbed8ebff..54371da1ae8a3 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 a4f6feaa740ca..1641266b0b1ba 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.'); }