mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-67673 phpunit: Fix the return type of template methods
All the setup/teardown/pre/post/conditions template methods now are required to return void. This was warned with phpunit 7 and now is enforced. At the same time, fix a few wrong function names, provider data and param types, return statements...
This commit is contained in:
parent
bdc3ad00c9
commit
f6711bb394
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ require_once(__DIR__ . '/fixtures/event.php');
|
||||
*/
|
||||
class logstore_database_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->preventResetByRollback(); // Logging waits till the transaction gets committed.
|
||||
|
@ -48,7 +48,7 @@ require_once(__DIR__ . '/fixtures/event.php');
|
||||
*/
|
||||
class logstore_legacy_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ require_once(__DIR__ . '/fixtures/event.php');
|
||||
*/
|
||||
class logstore_standard_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->preventResetByRollback(); // Logging waits till the transaction gets committed.
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Reset any garbage collector changes to the previous state at the end of the test.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
if ($this->wedisabledgc) {
|
||||
gc_enable();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ require_once($CFG->dirroot . '/admin/tool/log/store/standard/tests/fixtures/even
|
||||
*/
|
||||
class tool_log_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->preventResetByRollback(); // Logging waits till the transaction gets committed.
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
|
@ -44,7 +44,7 @@ use tool_messageinbound\privacy\provider;
|
||||
*/
|
||||
class tool_messageinbound_manager_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
@ -46,7 +46,7 @@ use tool_messageinbound\privacy\provider;
|
||||
*/
|
||||
class tool_messageinbound_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class tool_monitor_generator_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Enable monitor.
|
||||
set_config('enablemonitor', 1, 'tool_monitor');
|
||||
}
|
||||
@ -138,4 +138,4 @@ class tool_monitor_generator_testcase extends advanced_testcase {
|
||||
$this->assertEquals(1, $historydata->userid);
|
||||
$this->assertEquals(1, $historydata->sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -37,7 +37,7 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up method.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Enable monitor.
|
||||
set_config('enablemonitor', 1, 'tool_monitor');
|
||||
}
|
||||
@ -192,4 +192,4 @@ class tool_monitor_rule_manager_testcase extends advanced_testcase {
|
||||
$this->assertEmpty(array_diff(array_keys($ruledata), $ruleids));
|
||||
$this->assertCount(10, $ruledata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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.
|
||||
|
@ -36,7 +36,7 @@ use tool_usertours\local\filter\accessdate;
|
||||
*/
|
||||
class tool_usertours_accessdate_filter_test extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class tool_usertours_manager_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup to store the DB reference.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->db = $DB;
|
||||
@ -56,7 +56,7 @@ class tool_usertours_manager_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tear down to restore the original DB reference.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $DB;
|
||||
|
||||
$DB = $this->db;
|
||||
|
@ -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);
|
||||
|
@ -44,7 +44,7 @@ class step_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup to store the DB reference.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->db = $DB;
|
||||
@ -53,7 +53,7 @@ class step_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tear down to restore the original DB reference.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $DB;
|
||||
|
||||
$DB = $this->db;
|
||||
|
@ -46,7 +46,7 @@ class tour_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Setup to store the DB reference.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->db = $DB;
|
||||
@ -55,7 +55,7 @@ class tour_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tear down to restore the original DB reference.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $DB;
|
||||
|
||||
$DB = $this->db;
|
||||
|
@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class core_analytics_course_testcase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->course = $this->getDataGenerator()->create_course(['startdate' => 0]);
|
||||
|
@ -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(
|
||||
|
@ -41,7 +41,7 @@ require_once(__DIR__ . '/fixtures/test_analysis.php');
|
||||
*/
|
||||
class analytics_model_testcase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
|
||||
$this->setAdminUser();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -44,7 +44,7 @@ require_once(__DIR__ . '/fixtures/test_target_course_users.php');
|
||||
*/
|
||||
class core_analytics_privacy_model_testcase extends \core_privacy\tests\provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
$this->setAdminUser();
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class core_auth_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Set up for every test
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
@ -60,7 +60,7 @@ class core_auth_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Tear down to restore old logging..
|
||||
*/
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
ini_set('error_log', $this->oldlog);
|
||||
parent::tearDown();
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ use core_auth\privacy\provider;
|
||||
*/
|
||||
class core_auth_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class availability_completion_condition_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Load required classes.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
availability_completion\condition::wipe_static_cache();
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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();
|
||||
|
@ -36,7 +36,7 @@ use core_availability\info_section;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class info_testcase extends advanced_testcase {
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Load the mock condition so that it can be used.
|
||||
require_once(__DIR__ . '/fixtures/mock_condition.php');
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tree_testcase extends \advanced_testcase {
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Load the mock classes so they can be used.
|
||||
require_once(__DIR__ . '/fixtures/mock_condition.php');
|
||||
require_once(__DIR__ . '/fixtures/mock_info.php');
|
||||
|
@ -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);
|
||||
|
@ -41,7 +41,7 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase {
|
||||
/** @var string saved hash of an icon file used during testing */
|
||||
protected $iconhash;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
$this->tempdir = convert_helper::generate_id('unittest');
|
||||
@ -75,7 +75,7 @@ class core_backup_moodle1_converter_testcase extends advanced_testcase {
|
||||
);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
global $CFG;
|
||||
if (empty($CFG->keeptempdirectoriesonbackup)) {
|
||||
fulldelete($this->tempdirpath);
|
||||
|
@ -31,7 +31,7 @@ require_once($CFG->dirroot . '/backup/moodle2/backup_custom_fields.php');
|
||||
|
||||
class core_backup_encrypted_content_testscase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
if (!function_exists('openssl_encrypt')) {
|
||||
$this->markTestSkipped('OpenSSL extension is not loaded.');
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -66,7 +66,7 @@ class core_backup_course_copy_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up tasks for all tests.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB, $CFG, $USER;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
@ -633,4 +633,4 @@ class core_backup_course_copy_testcase extends advanced_testcase {
|
||||
$this->expectException(\moodle_exception::class);
|
||||
new \core_backup\copy\copy($formdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class backup_external_testcase extends externallib_advanced_testcase {
|
||||
/**
|
||||
* Set up tasks for all tests.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
@ -179,4 +179,4 @@ class backup_external_testcase extends externallib_advanced_testcase {
|
||||
$this->assertEquals(0, $restorerec->progress);
|
||||
$this->assertEquals('restore', $restorerec->operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -40,7 +40,7 @@ require_once($CFG->dirroot . '/backup/util/factories/backup_factory.class.php');
|
||||
*/
|
||||
class backup_factories_testcase extends advanced_testcase {
|
||||
|
||||
function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
parent::setUp();
|
||||
|
||||
@ -57,7 +57,7 @@ class backup_factories_testcase extends advanced_testcase {
|
||||
/**
|
||||
* test get_logger_chain() method
|
||||
*/
|
||||
function test_backup_factory() {
|
||||
public function test_backup_factory() {
|
||||
global $CFG;
|
||||
|
||||
// Default instantiate, all levels = backup::LOG_NONE
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -48,7 +48,7 @@ require_once($CFG->libdir . '/badgeslib.php');
|
||||
*/
|
||||
class core_badges_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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');
|
||||
|
@ -42,7 +42,7 @@ class block_recentlyaccesseditems_observer_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set up for every test
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@ -157,4 +157,4 @@ class block_recentlyaccesseditems_observer_testcase extends advanced_testcase {
|
||||
$records = $DB->count_records($this->table, array('cmid' => $this->chat->cmid));
|
||||
$this->assertEquals(2, $records);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ use core_block\privacy\provider;
|
||||
*/
|
||||
class core_block_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -47,7 +47,7 @@ require_once($CFG->dirroot . '/comment/lib.php');
|
||||
*/
|
||||
class core_blog_privacy_testcase extends provider_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
6
cache/stores/apcu/tests/apcu_test.php
vendored
6
cache/stores/apcu/tests/apcu_test.php
vendored
@ -45,11 +45,11 @@ class cachestore_apcu_test extends cachestore_tests {
|
||||
return 'cachestore_apcu';
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
if (!cachestore_apcu::are_requirements_met()) {
|
||||
$this->markTestSkipped('Could not test cachestore_apcu. Requirements are not met.');
|
||||
}
|
||||
return parent::setUp();
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,4 +88,4 @@ class cachestore_apcu_test extends cachestore_tests {
|
||||
$instance2->purge();
|
||||
$this->assertSame(1, $instance->get('test1'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
cache/stores/redis/tests/compressor_test.php
vendored
2
cache/stores/redis/tests/compressor_test.php
vendored
@ -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.');
|
||||
}
|
||||
|
6
cache/stores/redis/tests/redis_test.php
vendored
6
cache/stores/redis/tests/redis_test.php
vendored
@ -54,13 +54,13 @@ class cachestore_redis_test extends cachestore_tests {
|
||||
return 'cachestore_redis';
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
if (!cachestore_redis::are_requirements_met() || !defined('TEST_CACHESTORE_REDIS_TESTSERVERS')) {
|
||||
$this->markTestSkipped('Could not test cachestore_redis. Requirements are not met.');
|
||||
}
|
||||
parent::setUp();
|
||||
}
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
parent::tearDown();
|
||||
|
||||
if ($this->store instanceof cachestore_redis) {
|
||||
@ -123,4 +123,4 @@ class cachestore_redis_test extends cachestore_tests {
|
||||
$this->assertFalse($store->release_lock('lock', '321'));
|
||||
$this->assertTrue($store->release_lock('lock', '123'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
cache/tests/administration_helper_test.php
vendored
4
cache/tests/administration_helper_test.php
vendored
@ -45,7 +45,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set things back to the default before each test.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
cache_factory::reset();
|
||||
cache_config_testing::create_default_configuration();
|
||||
@ -54,7 +54,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Final task is to reset the cache system
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
public static function tearDownAfterClass(): void {
|
||||
parent::tearDownAfterClass();
|
||||
cache_factory::reset();
|
||||
}
|
||||
|
4
cache/tests/cache_test.php
vendored
4
cache/tests/cache_test.php
vendored
@ -44,7 +44,7 @@ class core_cache_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set things back to the default before each test.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
cache_factory::reset();
|
||||
cache_config_testing::create_default_configuration();
|
||||
@ -53,7 +53,7 @@ class core_cache_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Final task is to reset the cache system
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
public static function tearDownAfterClass(): void {
|
||||
parent::tearDownAfterClass();
|
||||
cache_factory::reset();
|
||||
}
|
||||
|
4
cache/tests/config_writer_test.php
vendored
4
cache/tests/config_writer_test.php
vendored
@ -44,7 +44,7 @@ class core_cache_config_writer_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Set things back to the default before each test.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
cache_factory::reset();
|
||||
cache_config_testing::create_default_configuration();
|
||||
@ -53,7 +53,7 @@ class core_cache_config_writer_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Final task is to reset the cache system
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
public static function tearDownAfterClass(): void {
|
||||
parent::tearDownAfterClass();
|
||||
cache_factory::reset();
|
||||
}
|
||||
|
4
cache/tests/fixtures/stores.php
vendored
4
cache/tests/fixtures/stores.php
vendored
@ -46,7 +46,7 @@ abstract class cachestore_tests extends advanced_testcase {
|
||||
* Sets up the fixture, for example, open a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$class = $this->get_class_name();
|
||||
if (!class_exists($class) || !$class::are_requirements_met()) {
|
||||
$this->markTestSkipped('Could not test '.$class.'. Requirements are not met.');
|
||||
@ -190,4 +190,4 @@ abstract class cachestore_tests extends advanced_testcase {
|
||||
$this->assertSame(3, $instance->delete_many(array('many2', 'many3', 'many4')));
|
||||
$this->assertSame(2, $instance->delete_many(array('many1', 'many5', 'many6')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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');
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class core_calendar_lib_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Tests set up
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user