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:
Eloy Lafuente (stronk7) 2020-08-02 10:59:12 +02:00
parent c611109ed7
commit d81a94807b
421 changed files with 531 additions and 531 deletions

View file

@ -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);
}

View file

@ -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();

View file

@ -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.

View file

@ -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.

View file

@ -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();
}

View file

@ -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();

View file

@ -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.

View file

@ -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();

View file

@ -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();

View file

@ -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();

View file

@ -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 @@ class core_enrol_role_external_testcase extends externallib_advanced_testcase {
$categories = core_role_external::unassign_roles(
array('roleid' => 3, 'userid' => $USER->id, 'contextid' => $context->id));
}
}
}