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:
+11
-11
@@ -29,7 +29,7 @@ class fields_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests getting the user picture fields.
|
||||
*/
|
||||
public function test_get_picture_fields() {
|
||||
public function test_get_picture_fields(): void {
|
||||
$this->assertEquals(['id', 'picture', 'firstname', 'lastname', 'firstnamephonetic',
|
||||
'lastnamephonetic', 'middlename', 'alternatename', 'imagealt', 'email'],
|
||||
fields::get_picture_fields());
|
||||
@@ -38,7 +38,7 @@ class fields_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests getting the user name fields.
|
||||
*/
|
||||
public function test_get_name_fields() {
|
||||
public function test_get_name_fields(): void {
|
||||
$this->assertEquals(['firstnamephonetic', 'lastnamephonetic', 'middlename', 'alternatename',
|
||||
'firstname', 'lastname'],
|
||||
fields::get_name_fields());
|
||||
@@ -51,7 +51,7 @@ class fields_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests getting the identity fields.
|
||||
*/
|
||||
public function test_get_identity_fields() {
|
||||
public function test_get_identity_fields(): void {
|
||||
global $DB, $CFG, $COURSE;
|
||||
|
||||
$this->resetAfterTest();
|
||||
@@ -182,7 +182,7 @@ class fields_test extends \advanced_testcase {
|
||||
* to test the details of the identity permissions as that was already covered. Just how they
|
||||
* are included/combined.
|
||||
*/
|
||||
public function test_get_required_fields() {
|
||||
public function test_get_required_fields(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Set up some profile fields.
|
||||
@@ -232,7 +232,7 @@ class fields_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests the get_required_fields function when you use the $limitpurposes parameter.
|
||||
*/
|
||||
public function test_get_required_fields_limitpurposes() {
|
||||
public function test_get_required_fields_limitpurposes(): void {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Set up some profile fields.
|
||||
@@ -264,7 +264,7 @@ class fields_test extends \advanced_testcase {
|
||||
/**
|
||||
* There should be an exception if you try to 'limit' purposes to one that wasn't even included.
|
||||
*/
|
||||
public function test_get_required_fields_limitpurposes_not_in_constructor() {
|
||||
public function test_get_required_fields_limitpurposes_not_in_constructor(): void {
|
||||
$fields = fields::for_identity(null);
|
||||
$this->expectExceptionMessage('$limitpurposes can only include purposes defined in object');
|
||||
$fields->get_required_fields([fields::PURPOSE_USERPIC]);
|
||||
@@ -296,7 +296,7 @@ class fields_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests getting SQL (and actually using it).
|
||||
*/
|
||||
public function test_get_sql_variations() {
|
||||
public function test_get_sql_variations(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -446,7 +446,7 @@ class fields_test extends \advanced_testcase {
|
||||
* Tests what happens if you use the SQL multiple times in a query (i.e. that it correctly
|
||||
* creates the different identifiers).
|
||||
*/
|
||||
public function test_get_sql_multiple() {
|
||||
public function test_get_sql_multiple(): void {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
|
||||
@@ -486,7 +486,7 @@ class fields_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests the get_sql function when there are no fields to retrieve.
|
||||
*/
|
||||
public function test_get_sql_nothing() {
|
||||
public function test_get_sql_nothing(): void {
|
||||
$fields = fields::empty();
|
||||
['selects' => $selects, 'joins' => $joins, 'params' => $joinparams] = (array)$fields->get_sql();
|
||||
$this->assertEquals('', $selects);
|
||||
@@ -498,7 +498,7 @@ class fields_test extends \advanced_testcase {
|
||||
* Tests get_sql when there are no custom fields; in this scenario, the joins and joinparams
|
||||
* are always blank.
|
||||
*/
|
||||
public function test_get_sql_no_custom_fields() {
|
||||
public function test_get_sql_no_custom_fields(): void {
|
||||
$fields = fields::empty()->including('city', 'country');
|
||||
['selects' => $selects, 'joins' => $joins, 'params' => $joinparams, 'mappings' => $mappings] =
|
||||
(array)$fields->get_sql('u');
|
||||
@@ -512,7 +512,7 @@ class fields_test extends \advanced_testcase {
|
||||
* Tests the format of the $selects string, which is important particularly for backward
|
||||
* compatibility.
|
||||
*/
|
||||
public function test_get_sql_selects_format() {
|
||||
public function test_get_sql_selects_format(): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
Reference in New Issue
Block a user