mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +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
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue