forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-79717 phpunit: ensure unique data provider keys in tests.
Duplicate data provider keys were overwriting and/or duplicating one another, leading to some cases being skipped. Other "duplicate array key" errors were picked up by `phpcs` in this dragnet across all tests, which have also been fixed.
- Loading branch information
1 parent
7d7a871
commit bd0f8a0
Showing
17 changed files
with
75 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* @author [email protected] | ||
* @author [email protected] | ||
*/ | ||
class moodlelib_test extends \advanced_testcase { | ||
final class moodlelib_test extends \advanced_testcase { | ||
|
||
/** | ||
* Define a local decimal separator. | ||
|
@@ -858,13 +858,15 @@ public function test_clean_param_timezone(): void { | |
'-13.5' => '', | ||
'0.2' => '', | ||
'' => '', | ||
null => '', | ||
); | ||
|
||
foreach ($testvalues as $testvalue => $expectedvalue) { | ||
$actualvalue = clean_param($testvalue, PARAM_TIMEZONE); | ||
$this->assertEquals($expectedvalue, $actualvalue); | ||
} | ||
|
||
// Test for null. | ||
$this->assertEquals('', clean_param(null, PARAM_TIMEZONE)); | ||
} | ||
|
||
/** | ||
|
@@ -3575,9 +3577,9 @@ public function test_setnew_password_and_mail(): void { | |
|
||
/** | ||
* Data provider for test_generate_confirmation_link | ||
* @return Array of confirmation urls and expected resultant confirmation links | ||
* @return array Confirmation urls and expected resultant confirmation links | ||
*/ | ||
public function generate_confirmation_link_provider() { | ||
public static function generate_confirmation_link_provider(): array { | ||
global $CFG; | ||
return [ | ||
"Simple name" => [ | ||
|
@@ -3645,7 +3647,7 @@ public function generate_confirmation_link_provider() { | |
"confirmationurl" => "http://moodle.org/ext.php?with=some¶m=eters", | ||
"expected" => "http://moodle.org/ext.php?with=some¶m=eters&data=/many_-%2E%40characters%40_%40-%2E%2E-%2E%2E" | ||
], | ||
"Custom external confirmation url with parameters" => [ | ||
"Custom external confirmation url with parameters (again)" => [ | ||
"username" => "many_-.@characters@[email protected]..", | ||
"confirmationurl" => "http://moodle.org/ext.php?with=some&data=test", | ||
"expected" => "http://moodle.org/ext.php?with=some&data=/many_-%2E%40characters%40_%40-%2E%2E-%2E%2E" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.