mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +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
c611109ed7
commit
d81a94807b
421 changed files with 531 additions and 531 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue