Commit f6711bb3 authored by Eloy Lafuente's avatar Eloy Lafuente
Browse files

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...
parent bdc3ad00
......@@ -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);
}
}
\ No newline at end of file
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment