MDL-81522 phpunit: Add missing void return type to all tests
While this change is not 100% required now, it's good habit and we are checking for it since Moodle 4.4. All the changes in this commit have been applied automatically using the moodle.PHPUnit.TestReturnType sniff and are, exclusively adding the ": void" return types when missing.
This commit is contained in:
@@ -32,7 +32,7 @@ require_once(__DIR__ . '/../lib.php');
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class questionutils_test extends \advanced_testcase {
|
||||
public function test_arrays_have_same_keys_and_values() {
|
||||
public function test_arrays_have_same_keys_and_values(): void {
|
||||
$this->assertTrue(question_utils::arrays_have_same_keys_and_values(
|
||||
array(),
|
||||
array()));
|
||||
@@ -53,7 +53,7 @@ class questionutils_test extends \advanced_testcase {
|
||||
array('sub0' => '1', 'sub1' => '2', 'sub2' => '3', 'sub3' => '1')));
|
||||
}
|
||||
|
||||
public function test_arrays_same_at_key() {
|
||||
public function test_arrays_same_at_key(): void {
|
||||
$this->assertTrue(question_utils::arrays_same_at_key(
|
||||
array(),
|
||||
array(),
|
||||
@@ -88,7 +88,7 @@ class questionutils_test extends \advanced_testcase {
|
||||
'key'));
|
||||
}
|
||||
|
||||
public function test_arrays_same_at_key_missing_is_blank() {
|
||||
public function test_arrays_same_at_key_missing_is_blank(): void {
|
||||
$this->assertTrue(question_utils::arrays_same_at_key_missing_is_blank(
|
||||
array(),
|
||||
array(),
|
||||
@@ -123,7 +123,7 @@ class questionutils_test extends \advanced_testcase {
|
||||
'key'));
|
||||
}
|
||||
|
||||
public function test_arrays_same_at_key_integer() {
|
||||
public function test_arrays_same_at_key_integer(): void {
|
||||
$this->assertTrue(question_utils::arrays_same_at_key_integer(
|
||||
array(),
|
||||
array(),
|
||||
@@ -158,7 +158,7 @@ class questionutils_test extends \advanced_testcase {
|
||||
'key'));
|
||||
}
|
||||
|
||||
public function test_int_to_roman() {
|
||||
public function test_int_to_roman(): void {
|
||||
$this->assertSame('i', question_utils::int_to_roman(1));
|
||||
$this->assertSame('iv', question_utils::int_to_roman(4));
|
||||
$this->assertSame('v', question_utils::int_to_roman(5));
|
||||
@@ -172,7 +172,7 @@ class questionutils_test extends \advanced_testcase {
|
||||
$this->assertSame('mmmcmxcix', question_utils::int_to_roman(3999));
|
||||
}
|
||||
|
||||
public function test_int_to_letter() {
|
||||
public function test_int_to_letter(): void {
|
||||
$this->assertEquals('A', question_utils::int_to_letter(1));
|
||||
$this->assertEquals('B', question_utils::int_to_letter(2));
|
||||
$this->assertEquals('C', question_utils::int_to_letter(3));
|
||||
@@ -201,22 +201,22 @@ class questionutils_test extends \advanced_testcase {
|
||||
$this->assertEquals('Z', question_utils::int_to_letter(26));
|
||||
}
|
||||
|
||||
public function test_int_to_roman_too_small() {
|
||||
public function test_int_to_roman_too_small(): void {
|
||||
$this->expectException(\moodle_exception::class);
|
||||
question_utils::int_to_roman(0);
|
||||
}
|
||||
|
||||
public function test_int_to_roman_too_big() {
|
||||
public function test_int_to_roman_too_big(): void {
|
||||
$this->expectException(\moodle_exception::class);
|
||||
question_utils::int_to_roman(4000);
|
||||
}
|
||||
|
||||
public function test_int_to_roman_not_int() {
|
||||
public function test_int_to_roman_not_int(): void {
|
||||
$this->expectException(\moodle_exception::class);
|
||||
question_utils::int_to_roman(1.5);
|
||||
}
|
||||
|
||||
public function test_clean_param_mark() {
|
||||
public function test_clean_param_mark(): void {
|
||||
$this->assertNull(question_utils::clean_param_mark(null));
|
||||
$this->assertNull(question_utils::clean_param_mark('frog'));
|
||||
$this->assertSame('', question_utils::clean_param_mark(''));
|
||||
|
||||
Reference in New Issue
Block a user