mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +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
|
@ -29,7 +29,7 @@ class antivirus_clamav_scanner_testcase extends advanced_testcase {
|
|||
/** @var string temporary file used in testing */
|
||||
protected $tempfile;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create tempfile.
|
||||
|
@ -38,7 +38,7 @@ class antivirus_clamav_scanner_testcase extends advanced_testcase {
|
|||
touch($this->tempfile);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
@unlink($this->tempfile);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class core_ddl_testcase extends database_driver_testcase {
|
|||
/** @var array table name => array of stdClass test records loaded into that table. Created in setUp. */
|
||||
private $records = array();
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$dbman = $this->tdb->get_manager(); // Loads DDL libs.
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
|
|||
|
||||
class core_dml_testcase extends database_driver_testcase {
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$dbman = $this->tdb->get_manager(); // Loads DDL libs.
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class pgsql_native_recordset_testcase extends basic_testcase {
|
|||
/**
|
||||
* Creates a second db connection and a temp table with values in for testing.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
parent::setUp();
|
||||
|
@ -87,7 +87,7 @@ class pgsql_native_recordset_testcase extends basic_testcase {
|
|||
/**
|
||||
* Gets rid of the second db connection.
|
||||
*/
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
if ($this->specialdb) {
|
||||
$table = new xmldb_table('silly_test_table');
|
||||
$this->specialdb->get_manager()->drop_table($table);
|
||||
|
|
|
@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die();
|
|||
*/
|
||||
class core_recordset_walk_testcase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ require_once($CFG->dirroot.'/lib/dml/sqlsrv_native_moodle_database.php');
|
|||
*/
|
||||
class sqlsrv_native_moodle_database_testcase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class file_browser_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Set up
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class core_files_file_system_filedir_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Shared test setUp.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Reset the file storage so that subsequent fetches to get_file_storage are called after
|
||||
// configuration is prepared.
|
||||
get_file_storage(true);
|
||||
|
@ -52,7 +52,7 @@ class core_files_file_system_filedir_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Shared teset tearDown.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
// Reset the file storage so that subsequent tests will use the standard file storage.
|
||||
get_file_storage(true);
|
||||
}
|
||||
|
|
|
@ -39,11 +39,11 @@ require_once($CFG->libdir . '/filestorage/file_system.php');
|
|||
*/
|
||||
class core_files_file_system_testcase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
get_file_storage(true);
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
get_file_storage(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class core_files_zip_packer_testcase extends advanced_testcase implements file_p
|
|||
*/
|
||||
protected $progress;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->testfile = __DIR__.'/fixtures/test.txt';
|
||||
|
|
|
@ -50,7 +50,7 @@ class core_form_dateselector_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Initalize test wide variable, it is called in start of the testcase
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG;
|
||||
parent::setUp();
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class core_form_datetimeselector_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Initalize test wide variable, it is called in start of the testcase
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG;
|
||||
parent::setUp();
|
||||
|
||||
|
|
2
lib/grade/tests/fixtures/lib.php
vendored
2
lib/grade/tests/fixtures/lib.php
vendored
|
@ -49,7 +49,7 @@ abstract class grade_base_testcase extends advanced_testcase {
|
|||
protected $courseid;
|
||||
protected $userid;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG;
|
||||
parent::setup();
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ abstract class database_driver_testcase extends base_testcase {
|
|||
$this->setRunTestInSeparateProcess(false);
|
||||
}
|
||||
|
||||
public static function setUpBeforeClass() {
|
||||
public static function setUpBeforeClass(): void {
|
||||
global $CFG;
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
|
@ -101,7 +101,7 @@ abstract class database_driver_testcase extends base_testcase {
|
|||
self::$extradb = $d;
|
||||
}
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $DB;
|
||||
parent::setUp();
|
||||
|
||||
|
@ -112,7 +112,7 @@ abstract class database_driver_testcase extends base_testcase {
|
|||
}
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
// delete all test tables
|
||||
$dbman = $this->tdb->get_manager();
|
||||
$tables = $this->tdb->get_tables(false);
|
||||
|
@ -125,7 +125,7 @@ abstract class database_driver_testcase extends base_testcase {
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass() {
|
||||
public static function tearDownAfterClass(): void {
|
||||
if (self::$extradb) {
|
||||
self::$extradb->dispose();
|
||||
self::$extradb = null;
|
||||
|
|
|
@ -51,7 +51,7 @@ abstract class restore_date_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Setup.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
parent::setUp();
|
||||
|
@ -160,4 +160,4 @@ abstract class restore_date_testcase extends advanced_testcase {
|
|||
return ($this->restorestartdate - $this->startdate);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ defined('MOODLE_INTERNAL') || die();
|
|||
class core_phpunit_basic_testcase extends basic_testcase {
|
||||
protected $testassertexecuted = false;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
if ($this->getName() === 'test_setup_assert') {
|
||||
$this->assertTrue(true);
|
||||
|
|
|
@ -29,7 +29,7 @@ class core_ajaxlib_testcase extends advanced_testcase {
|
|||
/** @var string Original error log */
|
||||
protected $oldlog;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
parent::setUp();
|
||||
|
@ -38,7 +38,7 @@ class core_ajaxlib_testcase extends advanced_testcase {
|
|||
ini_set('error_log', "$CFG->dataroot/testlog.log");
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
ini_set('error_log', $this->oldlog);
|
||||
parent::tearDown();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ require_once(__DIR__ . '/fixtures/testable_antivirus.php');
|
|||
class core_antivirus_testcase extends advanced_testcase {
|
||||
protected $tempfile;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG;
|
||||
// Use our special testable fixture plugin.
|
||||
$CFG->antiviruses = 'testable';
|
||||
|
@ -42,7 +42,7 @@ class core_antivirus_testcase extends advanced_testcase {
|
|||
touch($this->tempfile);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
@unlink($this->tempfile);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class core_blocklib_testcase extends advanced_testcase {
|
|||
protected $blockmanager;
|
||||
protected $isediting = null;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->testpage = new moodle_page();
|
||||
$this->testpage->set_context(context_system::instance());
|
||||
|
@ -47,7 +47,7 @@ class core_blocklib_testcase extends advanced_testcase {
|
|||
$this->blockmanager = new testable_block_manager($this->testpage);
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
$this->testpage = null;
|
||||
$this->blockmanager = null;
|
||||
parent::tearDown();
|
||||
|
|
|
@ -39,7 +39,7 @@ class core_calendar_cron_task_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Tests set up
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class core_collator_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Prepares things for this test case.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $SESSION;
|
||||
if (isset($SESSION->lang)) {
|
||||
$this->initiallang = $SESSION->lang;
|
||||
|
@ -65,7 +65,7 @@ class core_collator_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Cleans things up after this test case has run.
|
||||
*/
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
global $SESSION;
|
||||
parent::tearDown();
|
||||
if ($this->initiallang !== null) {
|
||||
|
|
|
@ -38,7 +38,7 @@ class core_component_testcase extends advanced_testcase {
|
|||
*/
|
||||
const SUBSYSTEMCOUNT = 71;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$psr0namespaces = new ReflectionProperty('core_component', 'psr0namespaces');
|
||||
$psr0namespaces->setAccessible(true);
|
||||
$this->oldpsr0namespaces = $psr0namespaces->getValue(null);
|
||||
|
@ -47,7 +47,7 @@ class core_component_testcase extends advanced_testcase {
|
|||
$psr4namespaces->setAccessible(true);
|
||||
$this->oldpsr4namespaces = $psr4namespaces->getValue(null);
|
||||
}
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
$psr0namespaces = new ReflectionProperty('core_component', 'psr0namespaces');
|
||||
$psr0namespaces->setAccessible(true);
|
||||
$psr0namespaces->setValue(null, $this->oldpsr0namespaces);
|
||||
|
|
|
@ -40,7 +40,7 @@ class core_media_player_native_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Pre-test setup.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
@ -160,4 +160,4 @@ class core_media_player_native_testcase extends advanced_testcase {
|
|||
$this->assertNotContains('<source src="http://example.org/some_filename.mp4" />', $content);
|
||||
$this->assertNotContains('<source src="http://example.org/some_filename_hires.mp4" />', $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class core_csvclass_testcase extends advanced_testcase {
|
|||
protected $teststring3 = '';
|
||||
protected $teststring4 = '';
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class customcontext_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Perform setup before every test. This tells Moodle's phpunit to reset the database after every test.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class contentbank_content_created_testcase extends \advanced_testcase {
|
|||
/**
|
||||
* Setup to ensure that fixtures are loaded.
|
||||
*/
|
||||
public static function setUpBeforeClass() {
|
||||
public static function setUpBeforeClass(): void {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php');
|
||||
|
|
|
@ -39,7 +39,7 @@ class contentbank_content_deleted_testcase extends \advanced_testcase {
|
|||
/**
|
||||
* Setup to ensure that fixtures are loaded.
|
||||
*/
|
||||
public static function setUpBeforeClass() {
|
||||
public static function setUpBeforeClass(): void {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php');
|
||||
|
|
|
@ -39,7 +39,7 @@ class contentbank_content_updated_testcase extends \advanced_testcase {
|
|||
/**
|
||||
* Setup to ensure that fixtures are loaded.
|
||||
*/
|
||||
public static function setUpBeforeClass() {
|
||||
public static function setUpBeforeClass(): void {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php');
|
||||
|
|
|
@ -41,7 +41,7 @@ class contentbank_content_uploaded_testcase extends \advanced_testcase {
|
|||
/**
|
||||
* Setup to ensure that fixtures are loaded.
|
||||
*/
|
||||
public static function setUpBeforeClass() {
|
||||
public static function setUpBeforeClass(): void {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php');
|
||||
|
|
|
@ -39,7 +39,7 @@ class contentbank_content_viewed_testcase extends \advanced_testcase {
|
|||
/**
|
||||
* Setup to ensure that fixtures are loaded.
|
||||
*/
|
||||
public static function setUpBeforeClass() {
|
||||
public static function setUpBeforeClass(): void {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/contentbank/tests/fixtures/testable_contenttype.php');
|
||||
|
|
|
@ -42,7 +42,7 @@ class core_event_profile_field_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Test set up.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class core_event_user_graded_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Tests set up.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class core_events_testcase extends advanced_testcase {
|
|||
*
|
||||
* This is executed before running any test in this file.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class core_exporter_testcase extends advanced_testcase {
|
|||
protected $validdata = null;
|
||||
protected $invaliddata = null;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$s = new stdClass();
|
||||
$this->validrelated = array(
|
||||
'simplestdClass' => $s,
|
||||
|
|
|
@ -32,11 +32,11 @@ require_once($CFG->libdir . '/externallib.php');
|
|||
class core_externallib_testcase extends advanced_testcase {
|
||||
protected $DB;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->DB = null;
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $DB;
|
||||
if ($this->DB !== null) {
|
||||
$DB = $this->DB;
|
||||
|
|
|
@ -38,7 +38,7 @@ class core_gdlib_testcase extends basic_testcase {
|
|||
|
||||
private $fixturepath = null;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->fixturepath = __DIR__ . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ defined('MOODLE_INTERNAL') || die();
|
|||
*/
|
||||
class h5p_get_content_types_task_testcase extends advanced_testcase {
|
||||
|
||||
protected function setup() {
|
||||
protected function setup(): void {
|
||||
global $CFG;
|
||||
parent::setUp();
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class lock_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Some lock types will store data in the database.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class core_medialib_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Pre-test setup. Preserves $CFG.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
// Reset $CFG and $SERVER.
|
||||
|
@ -496,4 +496,4 @@ class core_medialib_testcase extends advanced_testcase {
|
|||
}
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class core_moodle_page_testcase extends advanced_testcase {
|
|||
*/
|
||||
protected $testpage;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->resetAfterTest();
|
||||
$this->testpage = new testable_moodle_page();
|
||||
|
|
|
@ -51,7 +51,7 @@ class core_myprofilelib_testcase extends advanced_testcase {
|
|||
*/
|
||||
private $tree;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
// Set the $PAGE->url value so core_myprofile_navigation() doesn't complain.
|
||||
global $PAGE;
|
||||
$PAGE->set_url('/test');
|
||||
|
|
|
@ -42,7 +42,7 @@ class core_notification_testcase extends advanced_testcase {
|
|||
* This includes emptying the list of notifications on the session, resetting any session which exists, and setting
|
||||
* up a new moodle_page object.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $PAGE, $SESSION;
|
||||
|
||||
parent::setUp();
|
||||
|
@ -57,7 +57,7 @@ class core_notification_testcase extends advanced_testcase {
|
|||
* This includes emptying the list of notifications on the session, resetting any session which exists, and setting
|
||||
* up a new moodle_page object.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $PAGE, $SESSION;
|
||||
|
||||
$PAGE = null;
|
||||
|
|
|
@ -34,7 +34,7 @@ global $CFG;
|
|||
*/
|
||||
class core_persistent_testcase extends advanced_testcase {
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->make_persistent_table();
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ require_once($CFG->dirroot.'/lib/tests/fixtures/testable_plugininfo_base.php');
|
|||
*/
|
||||
class core_plugin_manager_testcase extends advanced_testcase {
|
||||
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
// The caches of the testable singleton must be reset explicitly. It is
|
||||
// safer to kill the whole testable singleton at the end of every test.
|
||||
testable_core_plugin_manager::reset_caches();
|
||||
|
|
|
@ -50,7 +50,7 @@ class base_testcase extends \advanced_testcase {
|
|||
/**
|
||||
* Tear down the testable plugin manager singleton between tests.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
// The caches of the testable singleton must be reset explicitly. It is
|
||||
// safer to kill the whole testable singleton at the end of every test.
|
||||
testable_core_plugin_manager::reset_caches();
|
||||
|
|
|
@ -49,7 +49,7 @@ class core_questionlib_testcase extends advanced_testcase {
|
|||
*
|
||||
* This is executed before running any test in this file.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class core_rsslib_testcase extends advanced_testcase {
|
|||
// The number of seconds tests should wait for the server to respond (high to prevent false positives).
|
||||
const TIMEOUT = 10;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
moodle_simplepie::reset_cache();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class core_session_redis_testcase extends advanced_testcase {
|
|||
/** @var $redis The current testing redis connection */
|
||||
protected $redis = null;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
|
||||
if (!extension_loaded('redis')) {
|
||||
|
@ -79,7 +79,7 @@ class core_session_redis_testcase extends advanced_testcase {
|
|||
$this->redis->connect(TEST_SESSION_REDIS_HOST);
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
if (!extension_loaded('redis') || !defined('TEST_SESSION_REDIS_HOST')) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class core_statslib_testcase extends advanced_testcase {
|
|||
* Setup function
|
||||
* - Allow changes to CFG->debug for testing purposes.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
global $CFG, $DB;
|
||||
parent::setUp();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class task_database_logger_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Setup to backup the database before mocking.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $DB;
|
||||
|
||||
$this->DB = $DB;
|
||||
|
@ -52,7 +52,7 @@ class task_database_logger_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Tear down to unmock the database where it was mocked.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $DB;
|
||||
|
||||
$DB = $this->DB;
|
||||
|
|
|
@ -43,7 +43,7 @@ class core_task_logmanager extends advanced_testcase {
|
|||
/**
|
||||
* Relevant tearDown for logging tests.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
global $DB;
|
||||
|
||||
// Ensure that any logging is always ended.
|
||||
|
|
|
@ -44,7 +44,7 @@ class core_analytics_time_splittings_testcase extends advanced_testcase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class core_user_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Setup test data.
|
||||
*/
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class core_useragent_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Restores the user agent to the default one.
|
||||
*/
|
||||
public function tearDown() {
|
||||
public function tearDown(): void {
|
||||
core_useragent::instance(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class post_statement_testcase extends externallib_advanced_testcase {
|
|||
/**
|
||||
* Setup test.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
global $CFG;
|
||||
// We disable group actors on the test xapi_handler.
|
||||
$CFG->xapitestforcegroupactors = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue