mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +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
6
cache/stores/apcu/tests/apcu_test.php
vendored
6
cache/stores/apcu/tests/apcu_test.php
vendored
|
@ -45,11 +45,11 @@ class cachestore_apcu_test extends cachestore_tests {
|
|||
return 'cachestore_apcu';
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
if (!cachestore_apcu::are_requirements_met()) {
|
||||
$this->markTestSkipped('Could not test cachestore_apcu. Requirements are not met.');
|
||||
}
|
||||
return parent::setUp();
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,4 +88,4 @@ class cachestore_apcu_test extends cachestore_tests {
|
|||
$instance2->purge();
|
||||
$this->assertSame(1, $instance->get('test1'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
cache/stores/redis/tests/compressor_test.php
vendored
2
cache/stores/redis/tests/compressor_test.php
vendored
|
@ -45,7 +45,7 @@ class cachestore_redis_compressor_test extends advanced_testcase {
|
|||
/**
|
||||
* Test set up
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
if (!cachestore_redis::are_requirements_met() || !defined('TEST_CACHESTORE_REDIS_TESTSERVERS')) {
|
||||
$this->markTestSkipped('Could not test cachestore_redis. Requirements are not met.');
|
||||
}
|
||||
|
|
6
cache/stores/redis/tests/redis_test.php
vendored
6
cache/stores/redis/tests/redis_test.php
vendored
|
@ -54,13 +54,13 @@ class cachestore_redis_test extends cachestore_tests {
|
|||
return 'cachestore_redis';
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
if (!cachestore_redis::are_requirements_met() || !defined('TEST_CACHESTORE_REDIS_TESTSERVERS')) {
|
||||
$this->markTestSkipped('Could not test cachestore_redis. Requirements are not met.');
|
||||
}
|
||||
parent::setUp();
|
||||
}
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
parent::tearDown();
|
||||
|
||||
if ($this->store instanceof cachestore_redis) {
|
||||
|
@ -123,4 +123,4 @@ class cachestore_redis_test extends cachestore_tests {
|
|||
$this->assertFalse($store->release_lock('lock', '321'));
|
||||
$this->assertTrue($store->release_lock('lock', '123'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
cache/tests/administration_helper_test.php
vendored
4
cache/tests/administration_helper_test.php
vendored
|
@ -45,7 +45,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Set things back to the default before each test.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
cache_factory::reset();
|
||||
cache_config_testing::create_default_configuration();
|
||||
|
@ -54,7 +54,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Final task is to reset the cache system
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
public static function tearDownAfterClass(): void {
|
||||
parent::tearDownAfterClass();
|
||||
cache_factory::reset();
|
||||
}
|
||||
|
|
4
cache/tests/cache_test.php
vendored
4
cache/tests/cache_test.php
vendored
|
@ -44,7 +44,7 @@ class core_cache_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Set things back to the default before each test.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
cache_factory::reset();
|
||||
cache_config_testing::create_default_configuration();
|
||||
|
@ -53,7 +53,7 @@ class core_cache_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Final task is to reset the cache system
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
public static function tearDownAfterClass(): void {
|
||||
parent::tearDownAfterClass();
|
||||
cache_factory::reset();
|
||||
}
|
||||
|
|
4
cache/tests/config_writer_test.php
vendored
4
cache/tests/config_writer_test.php
vendored
|
@ -44,7 +44,7 @@ class core_cache_config_writer_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Set things back to the default before each test.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
cache_factory::reset();
|
||||
cache_config_testing::create_default_configuration();
|
||||
|
@ -53,7 +53,7 @@ class core_cache_config_writer_testcase extends advanced_testcase {
|
|||
/**
|
||||
* Final task is to reset the cache system
|
||||
*/
|
||||
public static function tearDownAfterClass() {
|
||||
public static function tearDownAfterClass(): void {
|
||||
parent::tearDownAfterClass();
|
||||
cache_factory::reset();
|
||||
}
|
||||
|
|
4
cache/tests/fixtures/stores.php
vendored
4
cache/tests/fixtures/stores.php
vendored
|
@ -46,7 +46,7 @@ abstract class cachestore_tests extends advanced_testcase {
|
|||
* Sets up the fixture, for example, open a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$class = $this->get_class_name();
|
||||
if (!class_exists($class) || !$class::are_requirements_met()) {
|
||||
$this->markTestSkipped('Could not test '.$class.'. Requirements are not met.');
|
||||
|
@ -190,4 +190,4 @@ abstract class cachestore_tests extends advanced_testcase {
|
|||
$this->assertSame(3, $instance->delete_many(array('many2', 'many3', 'many4')));
|
||||
$this->assertSame(2, $instance->delete_many(array('many1', 'many5', 'many6')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue