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.
This commit is contained in:
@@ -25,7 +25,7 @@ namespace core;
|
||||
* @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 @@ class moodlelib_test extends \advanced_testcase {
|
||||
'-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 @@ EOF;
|
||||
|
||||
/**
|
||||
* 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 @@ EOF;
|
||||
"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"
|
||||
|
||||
Reference in New Issue
Block a user