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

@ -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 @@ class ods_logging_events_testcase extends advanced_testcase {
$this->assertEquals(context_course::instance($course->id), $event->get_context());
$this->assertEquals('ods', $event->get_export_type());
}
}
}

View file

@ -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 @@ class txt_logging_events_testcase extends advanced_testcase {
$this->assertEquals(context_course::instance($course->id), $event->get_context());
$this->assertEquals('txt', $event->get_export_type());
}
}
}

View file

@ -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 @@ class xls_logging_events_testcase extends advanced_testcase {
$this->assertEquals(context_course::instance($course->id), $event->get_context());
$this->assertEquals('xls', $event->get_export_type());
}
}
}

View file

@ -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 @@ class xml_logging_events_testcase extends advanced_testcase {
$this->assertEquals(context_course::instance($course->id), $event->get_context());
$this->assertEquals('xml', $event->get_export_type());
}
}
}

View file

@ -64,7 +64,7 @@ Bobby,Bunce,,"Moodle HQ","Rock on!",student5@example.com,75.00,,75.00,{exportdat
/** @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;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -279,7 +279,7 @@ class store_test extends advanced_testcase {
* @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([

View file

@ -46,7 +46,7 @@ require_once($CFG->libdir . '/gradelib.php');
*/
class core_grades_privacy_testcase extends provider_testcase {
public function setUp() {
public function setUp(): void {
global $PAGE;
$this->resetAfterTest();
$PAGE->get_renderer('core');